d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > What Is This Asking? Javascript
Add Reply New Topic New Poll
Member
Posts: 20,014
Joined: Mar 28 2009
Gold: 0.02
May 29 2012 01:04pm
Any help appreciated.

Create a function which defines one of each type of Javascript data (string,boolean,etc) and display the results of the typeof operator for each type.
Member
Posts: 827
Joined: Jan 16 2012
Gold: 0.00
Warn: 10%
May 29 2012 01:30pm
I don't understand exactly what you want, but if you want to know a type of a object, you can use typeof(object).

Example:

Code


function Types(){
var num = 0;
var str = "";
var boo = true;

alert(typeof(num));
alert(typeof(str));
alert(typeof(boo));
}



Member
Posts: 20,014
Joined: Mar 28 2009
Gold: 0.02
May 29 2012 01:33pm
Quote (StormHasHe @ May 29 2012 11:30am)
I don't understand exactly what you want, but if you want to know a type of a object, you can use typeof(object).

Example:

Codefunction Types(){
var num = 0;
var str = "";
var boo = true;

alert(typeof(num));
alert(typeof(str));
alert(typeof(boo));
}


alright yeah thats pretty much what i was doing...is that all the question is asking? seemed kind of simple

This post was edited by Lightro on May 29 2012 01:33pm
Member
Posts: 827
Joined: Jan 16 2012
Gold: 0.00
Warn: 10%
May 29 2012 01:55pm
The question is not very clear, I would assume that it is this answer, but it might not be

This post was edited by StormHasHe on May 29 2012 01:55pm
Member
Posts: 14,235
Joined: Apr 20 2007
Gold: 15.00
May 30 2012 12:27pm
Quote (Lightro @ May 29 2012 07:33pm)
alright yeah thats pretty much what i was doing...is that all the question is asking? seemed kind of simple


yes, this is the right solution
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll