Newbie here! I was trying to write a code that returns true for digits ranging from 0 - 9 ONLY. Found this working code:
String.prototype.digit = function() {
return /^\d$/.test(this);
};
Could someone explain what "this" mean in this scenario? And how do we decide to use it? I know it's related to function constructor, but I can't quite wrap my head around the concept.