JavaScript Array A - Z

In JavaScript, array could be numbers, strings or objects, or maybe boolean. But it could be also a mix of all of that.

Inside of Square Brackets [ ] everything is an array element.

Numbers Array: const number = [ 1, 2, 3, 4, 5 ];

Strings Array: const names= [ ‘Rahim’, ‘Rakib’, ‘Johnny’, ‘Joe’ ];

Objects Array: const objects= [ {name: ‘Fahim’ , age: 24, male: true}, {name: ‘Kathy’ , age: 22, male: false} ];

Booleans Array: const booleans = [ adult: true, male: false, ];

const mix = [ 1, 2, 5, 8, {name: ‘Fahim’ , age: 24, male: true}, ‘Rahim’, adult: true ];

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store