What will happen when ["demo"] 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 ["demo"] to Number in JavaScript −


Live Demo

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

I love programming (: That's all I know