What does ** (double asterisk) mean in JavaScript?


I was reviewing a suggested edit for a JavaScript question and there were many changes suggested, but what caught my eye was the suggestion to change the following line:

bodyCells[k].setAttribute("data-title", **array[i][m]**);

To this:

bodyCells[k].setAttribute("data-title", * * array[i][m] * * );

To me, both ** and * * don't look quite right in this context. Are either or both correct? If so, what is the meaning?

From searching online, it seems that unlike some languages, in JavaScript ** is NOT used for exponents. In fact, Math.pow() seems to be the function of choice for exponents. So it seems to have nothing to do with that.

UPDATE:

As of ECMAScript 2016, ** is now used in JavaScript for exponentiation. Thanks to Tomas Nikodym for pointing that out!


Answers:


Those would both be syntax errors. It is perhaps an attempt to use Markdown style for bold text (i.e. **text** becomes text). StackOverflow uses Markdown in questions, answers, and comments. It is completely unrelated to JavaScript.

However, in this case, the action seems to be intended to make that text bold.

Markdown