Back to articles
Array basic methods in j.s

Array basic methods in j.s

via Dev.tomohandass

In javascript,array methods are built in the functions that help you add,remove,or manipulate elements in the array. 1. Array length The length is property that tells you how many elements are in an array. EXAMPLE: Inside the array have a 4 elements.So the size of length is 4. OUTPUT: 4 2. Array toString() The toString() array method that coverets an array an array into a comma separated string. EXAMPLE: The toString method is join all elements into a string separate a comma. this method dose not change the original array. OUTPUT: BMW,TATA,BENZ,VOLVO 3. Array at() The at() method is used to access an elements in array using its indexed. EXAMPLE: The carbrand.at(2) returns an indexed element 2 is the "BENZ" Dose not modify the array. OUTPUT: BENZ 4. Array join() The join() method is used to covert an array into a string it's join all elements with a specified separator. It's behaves just like toString() . EXAMPLE: It this join() array method we gives the ( - ).so it's create a array int

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles