JS Startup

Challenges, Tips & Tricks & Tutorials

JavaScript Quiz – does typeof of Symbol really give a string

JavaScript Quiz – does typeof of Symbol really give a string

JavaScript Symbol –

The javascript symbol is a primitive data type of javascript like string, number, object, boolean etc.

The symbol is a very peculiar data type. Once you create a symbol, its value is kept private and for internal use

It’s syntax looks like –


For more detail about JavaScript Symbol click here.

JavaScript typeof –

The javascript typeof (typeof) operator is used to check the data type of the variable declared using var, let & const.

In return typeof, gives a string value which can be number, string, object, boolean, undefined etc.

It’s syntax looks like –

typeof operand


For more detail about javascript typeof.

JavaScript Question

In this javascript quiz, find out does typeof of Symbol really give a string as symbol is also a primitive value like other primitive value.

First, we create a variable foo using const keyword and assign a javascript symbol to it. And in symbol, we are passing a string “Number”.

const foo = Symbol(“Number”);

Now, we checking the output of foo using console log with .toString() method and it gives a string value “Symbol(Number)“.

console.log(foo.toString()); // output => “Symbol(Number)”

Finally, we now test the data type of variable foo using typeof operator in the console log. Any idea what should be the output.

Answer – “symbol

Click To Run Code


Now, you know the answer is “symbol” but i hope you didn’t hear about this data type.

As Symbol, is introduce in ECMAScript2015. But it’s rarely used. But variable assign with javascript symbol has a data type “symbol” not a string.

At last, That’s why we get an answer “symbol“.

I hope you understand the concept and logic behind it.

But wait, i have something more for you –

Check out our other javascript quiz – 

  1. JS Quiz – variable can be key and value in object
  2. JavaScript Quiz – array filter method can filter odd value
  3. JS Quiz – var in a block scope work
  4. JavaScript Quiz – string split method really a case sensitive


To participate in our javascript quiz or challenges, tutorial, tips & tricks make sure to join our jsstartup newsletter. So, you can able to participate in our daily challenges & learn the javascript concept.

And last but not the least, don’t forget to like, comment and share. It gives us a morale boost to remain to continue. Also, join our Facebook Page

If you have any questions, please feel free to ask me in the comment section and also let me know if you have any suggestions. As suggestions are always welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top
Share via
Copy link