...

View Full Version : Changing Variables



suendisra
04-18-2005, 08:10 PM
Is there a certain way to go about to changing a number into a string? I'm trying to make this number change into a string so I can then search the string and add to a different stuff because of what's inside of the first string. Can anybody help me?

BaldEagle
04-18-2005, 08:35 PM
You can use the toString method.

k = 25;
x = k.toString();

BaldEagle

glenngv
04-19-2005, 04:53 AM
If you will append the number into a string, you don't need to convert the number into a string because it is automatically converted to string.

var s = "blah"
var s2 = s + 1; //blah1

snowieken
04-19-2005, 08:25 AM
Back when I was still learning JavaScript (I still am sometimes, but hey) I didn't use ToString - I just added an empty string to the integer, like this:

var a = 1
a = "" + 1

Ah, the good old days of newbie coding. But it worked! :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum