How [ ] is converted to Number in JavaScript?

Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [ ] to Number in JavaScript.


Live Demo

<!DOCTYPE html>
      <p>Convert [] to Number</p>
         var myVal = [];
         document.write("Number: " + Number(myVal));
Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician