➢The sort() method sorts an array alphabetically:
EXAMPLE:
const cars = ["Saab" , "Volvo" , "BMW" ];
cars.sort();
➢The reverse() method reverses the elements in an array.
EXAMPLE:
const cars = ["Saab" , "Volvo" , "BMW" ];
cars.sort();
fruits.reverse
➢in 2015, JavaScript introduced an important new keyword: const.
➢It has become a common practice to declare arrays using const.
➢An array declared with const cannot be reassigned.
➢Arrays are Not Constants
➢Elements Can be Reassigned
EXAMPLE:
const cars = ["Saab" , "Volvo" , "BMW" ];
EXAMPLE:
const cars = ["Saab" , "Volvo" , "BMW" ];
cars[0 ] = "Toyota" ;
cars.push("Saab" );
BMR EDUCATION is optimized for learning and giving you Knowledge in all aspects. Concepts might be simplified to improve reading and learning. Education, Coding, and Reference are constantly reviewed to avoid errors, but we cannot warrant the full correctness of all content. While using the bmreducation website, you agree to have read and accepted terms and Conditions , and privacy policy .
© 2023 BMR EDUCATION