Javascript - Write program to Use the sort() method to sort the array alphabetically

Requirements

Write program to Use the sort() method to sort the array alphabetically

Sort the following array

var fruits = ["Banana", "Orange", "Apple", "Kiwi"];

Hint

Use the sort() method

Demo

var fruits = ["Banana", "Orange", "Apple", "Kiwi"];
fruits.sort();
console.log(fruits);

Result