Message from JavaScript discussions

January 2019

— Just read about it.

Its about coercion.

You can do:

var num = 2;

Number.prototype.valueOf = function() { return num++; }

var a = new Number(2) // doesnt matter what value you pass

if(a == 2 && a == 3){

Message permanent page


You just need to override the protoype method valueOf and take "advantage" of coercion but I dont think youll ever need that :D

— Oh yeah

— I see, but it's nice to have the ability to overwrite methods

— You can do nice things with that technique

— Yeah true

— Yep

— But there are so many weird edge cases with implicit coercion

— 😲

— Almost done git-draw2🤤 need to push that extention to chrome web store somehow..

— Nice

— I want to add an OwO to the void area between July and end of September