About Lesson
Non-Primitives Data Types
Non-primitive types (reference types) include Object, Array, and Function.
1. Object:
A collection of key-value pairs. Keys are strings, and values can be any data type.
JavaScript
let person = {name: "Sheetal Mathur", age: 23};
2. Array:
An ordered collection of values, which can be of any type.
JavaScript
let fruits = ["Apple", "Banana", "Cherry"];
3. Function:
A block of reusable code that can be executed when called.
JavaScript
function greet() {
console.log("Hello, World!");
}