Writings about one coder's stories & experiences.
What does the following code return in NodeJS?
var squaredNum = (4 + 1) ^ 2; return squaredNum;
I got my degree in mathematics so I would expect this to return the number 25. But actually, the result is quite different- it's the number 7!
The Carrot Is Not For Powers!
var squaredNum = Math.pow(4 + 1, 2) return squaredNum;
Your comment will be posted after it is approved.
Leave a Reply.
The posts on this site are written and maintained by Jim Lynch. About Jim...