On Jan 14, 9:15 pm, Joel Dart <[email protected]> wrote:
> Creating Number objects is pretty much useless. If you ever need an *object*
> that stores a
> number value, you can just create a custom object yourself and store the
> number value as
> a property - it's probably also better Object Oriented modelling than using a
> generic Number
> object with no inherent meaning in your model.
Here is a contrived example, but with some imagination I think some
utility could be applied to this.
var a = 6
var b = Number(6)
var c = new Number(6)
Number.prototype.valueOf = function(){
throw "Illegal usage."
}
console.log(a + 3) //9
console.log(b + 3) //9
console.log(c + 3) //Illegal usage
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]