Array Basic

 Array is another important build-in data structure in JS. Its syntax is

const personName = ['hari', 'shyam', 'gita', 'rabin']

*starts with big bracket ‘[]’

*Each element have index and determine the position of element in array.

Here index 0 is hari,1→shyam and so on.

*Array in js is dynamic means we can store different types of variable in array unlike other static programming langage.

Example

const personName = ['hari', 'shyam', 'gita', 'rabin']
personName[4] = 2000
console.log(personName)

Technically array is an object. It has bunch of build-in function

if type personName. → we can see its properties or method and we can use it.

like

console.log(personName.length) --->5
console.log(typeof personName) --->object

Comments

Popular posts from this blog

Redux toolkit

Array Advance

HTML – a must-know for building responsive and dynamic layouts.