Linked Questions

0 votes
2 answers
5k views

There was zero explanation about this in the book I'm reading. They just threw an example with this, and didn't bother to explain anything at all. I keep testing and experimenting with this in an ...
happy_story's user avatar
  • 1,185
7 votes
3 answers
747 views

If we add a method to Number function (or Boolean or String) like this Number.prototype.sayMyNumber = function(){ return "My number is " + this; } and then create a number object assign it to a ...
Flying Gambit's user avatar
2 votes
2 answers
132 views

I am learning difference between primitive and reference datatypes in JS and am confused by primitive values because on one hand primitive values have no properties or methods but on the other hand I ...
Andy's user avatar
  • 551
2 votes
1 answer
128 views

The objects have properties and methods in Javascript. The primitive data types don't have properties and methods. But I don't understand from where properties and methods come from of strings and ...
2 votes
0 answers
59 views

var num = 1; typeof num; //prints number console.log(num.__proto__); //prints Number console.log(num.__proto__.__proto__); //prints Object When variable num is behaving like a typical Object then why ...
Mangoose's user avatar
  • 922
3 votes
0 answers
54 views

I have this question in mind since I started learning JavaScript last month. What I have tried?: I researched for it online almost on all good sites but didn't get satisfactory answer in laymans ...
Mit Rao's user avatar
  • 43
1 vote
0 answers
44 views

I'm not a JavaScript newbie, but I was reading MDN page on primitive data types and it caught my attention the following line: A primitive (primitive value, primitive data type) is data that is not ...
ILikeTacos's user avatar
  • 18.9k
8 votes
4 answers
1k views

This question has come out of another, which concerns the behaviour of console.dir with string literals. In particular, see the comments on my answer. As we all know, String objects in JavaScript ...
4 votes
1 answer
101 views

While learning about the optional chaining operator I experimented a bit and found out that these two evaluate to undefined: false.nonExistingProperty // undefined true.nonExistingProperty // ...
Sven's user avatar
  • 13.4k
0 votes
1 answer
131 views

Are symbols acting like objects in JavaScript or a Symbol object is being created under the hood in the following example: const symbol = Symbol(); Symbol.prototype.sayHello = function () { console....
Petar's user avatar
  • 33