Skip to content

Instantly share code, notes, and snippets.

object : Objects in JavaScript, just as in many other programming languages, can be compared to objects in real life.
The concept of objects in JavaScript can be understood with real life, tangible objects.
In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup,
Creating a JavaScript Object
Example 1 :
const person = {firstName:"John", lastName:"Doe", age:50 };
person.firstName + " is " + person.age + " years old.";
Result :
'John is 50 years old.'
Spaces and line breaks are not important. An object definition can span multiple lines:
string : String is a primitive data type in JavaScript. A string is textual content.
It must be enclosed in single or double quotation marks.
Since, string is character index, it can be accessed using for loop and for-of loop.
( A JavaScript string is zero or more characters written inside quotes. )
Example
var name = "Ganesh";
Result :
"Ganesh"
String Length : To find the length of a string, use the built-in length property
ARRAY : An array is a special variable, which can hold more than one value at a time.
Creating an Array
Using an array literal is the easiest way to create a JavaScript Array.
Syntax:
const array_name = [item1, item2, ...];
Example
const bikes = ["PULSAR", "ACTIVA", "PLEASURE"];
Using the JavaScript Keyword new
React Native FlexBox
Flexbox : Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions.
The defaults are different, with flexDirection defaulting to column instead of row, alignContent
defaulting to flex-start instead of stretch, flexShrink defaulting to 0 instead of 1,
the flex parameter only supporting a single number.
Name Type
1 flexDirection row , row-reverse , column , column-reverse .
2 alignItems flex-start , flex-end , center , stretch , baseline .
3 justifyContent flex-start , flex-end , center , space-between , space-around.
4 alignSelf auto , flex-start , flex-end , center , stretch , baseline .