Hello Reader's if you want to get the return types of the variables in Javascript then in this blog you will learn about them.
for getting the return type you have to use the type of function in the JavaScript.
Let's see some of the return type with the variables below:-
<script>
document.getElementById("demo").innerHTML =
typeof "john" + "<br>" +
typeof 3.14 + "<br>" +
typeof NaN + "<br>" +
typeof false + "<br>" +
typeof [1,2,3,4] + "<br>" +
typeof {name:'john', age:34} + "<br>" +
typeof new Date() + "<br>" +
typeof function () {} + "<br>" +
typeof myCar + "<br>" +
typeof null;
</script>
Output:-
string
number
number
boolean
object
object
object
function
undefined
object
0 Comment(s)