Objects
in Javascript, a literal object is the best way to simplify an object if you don't support idle talk, and if you prefer to go straight to the point.(without initializernew Object();
)
you use{}
and you have keywords as strings and the value can be data like numbers, strings, arrays, functions, etc...
Below is an example :
const fruit={
name: "apple",
weight:50,
color: "red",
}
Arrays
You also use literal arrays on js, with []
, simplifying too in the majority of cases, but you can remember that you just use normal Array when you want to use a specific empty element on your array
Below is an example of Literal Arrays :
const fruits = ["apple", "banana", "orange"];
thanks for reading!
🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄
Top comments (0)