-1
rated 0 times
[
6]
[
7]
/ answers: 1 / hits: 129696
/ 11 Years ago, wed, july 3, 2013, 12:00:00
<script type=text/javascript>
function saveName (firstName) {
function capitalizeName () {
return firstName.toUpperCase();
}
var capitalized = capitalizeName();console.log(capitalized instanceof String);
return capitalized;
}
console.log(saveName(Robert)); // Returns ROBERT
</script>
Question:
I want to check the type of capitalized , so I use capitalized instanceof String
? But it shows: false
in console, I do not want to try capitalized instanceof Function
, Object
...It will take too much time, so what is the best way to detect a variable type?
More From » javascript