What is type conversions in javasript?

Most of the time, operators and functions automatically convert the values given to them to the right type.

let value = true;

alert(typeof value); // boolean

value = String(value); // now value is a string "true"

alert(typeof value); // string




    <p>Before the script...</p>


        alert(Boolean(1)); // true

        alert(Boolean(0)); // false

        alert(Boolean("hello")); // true

        alert(Boolean("")); // false


    <p>...After the script.</p>



0 Comment's

Comment Form