How to use JavaScript Array.from()

Program to use JavaScript Array.from() method

let a = 'JavaScript';
let b = Array.from(a);


    'J', 'a', 'v', 'a',
    'S', 'c', 'r', 'i',
    'p', 't'

Steps Description

  1. Declare two variable a and b
  2. Initialize two variable a and b with value of string a = 'JavaScript' and b = Array.from(a)
  3. Array.from() method creates new array from array element
  4. The value of b variable is displayed with the help of console.log inbuilt function