Tuesday, December 25, 2012

Convert Int to string

Importance of +""

We all are aware of string to Int conversion,(which could be accomplished by parseInt) but how do we convert a Int to string? We do have multiple solutions but one of the most easiest and commonly used procedure is +"".

Below example illustrates the same.

var x=Math.random(); // this generates random number and type of x is number.
var x=Math.random()+""; // now check the type of x its string!!!! how is that possible.

Note: Just by using +"" it converts the type from number to string. This implementation is mostly used in displaying date. It helps to CONCAT the date, month or year value instead of adding them.

Hope this post was helpful. Will be adding some more post shortly.

Informative Javascript


  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me..I am a regular follower of your blog.
    Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from HTML5 CSS3 Javascript Online Training from India .
    or learn thru HTML5 CSS3 Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. HTML5 CSS3 Javascript Online Training from India

  2. Read all the information that i've given in above article. It'll give u the whole idea about it.
    Best Devops Training in pune
    Data science training in Bangalore

  3. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
    python Course in Pune
    python Course institute in Chennai
    python Training institute in Bangalore

  4. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training