➢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
BMR EDUCATION is provided for learning and imparting knowledge in all aspects. Concepts may be simplified to enhance readability and learning. The content we provide is regularly reviewed to minimize errors, but we cannot guarantee the absolute correctness of all content. When using the BMR Education website, you agree to have read and accepted the Terms and Conditions , and Privacy Policy .
BMR EDUCATION © 2023 All rights reserved