0
[JavaScript] Converting Values to strings WITHOUT toString?
I've tried this a few times. But I've never successfully converted a given value to a string WITHOUT toString. Can anybody help me? Send me your code with comments please.
5 Réponses
+ 1
What's wrong with toString? Just curious.
Anyways, there are a couple other methods you can use. You can simply put "" prior to it and it'll convert it automatically (Example: "" + myNumVar) You can encompass it inside of String(). (Example: String(myNumVar)) And you can use toString as you already know.
That's only ways I can think of off the top of my head. Hope that helps.
0
Why don’t you want to use toString()? Is it some assignment requirement?
0
Just something I came up with one day. Lol.
0
while n>0:
s=chr(48+n%10)+s
n//=10
0
var num = 123;
var str = "" + num; // converted number to string