top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Does JavaScript Support automatic type conversion, If yes give example.

0 votes
477 views
Does JavaScript Support automatic type conversion, If yes give example.
posted Aug 25, 2015 by Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Yes! Javascript support automatic type conversion. You should take advantage of it, It is most common way of type conversion used by Javascript developers.
Ex.

var s = '5';
var a = s*1;
var b = +s;
typeof(s); //"string"
typeof(a); //"number"
typeof(b); //"number" ​
answer Aug 27, 2015 by Shivaranjini
...