Comment on Write a program that makes 2 + 2 = 5parentComments−blueveek12y7 bytes: !''|2+2:)−notduncansmith12y5 bytes: 1|2+2−NaNaN12yI think all these bytes are not creative. !![]+2+2 ? !''|2+2 ? 1|2+2 ? Why the use of new operators? Why not just write 1+2+2 ?−leorocky12yWell if you made a general add function that always performed an or operation on the least significant bit, it would be pretty interesting. You'd always flip odd and even in any addition.−notduncansmith12yTo make many more examples of why Javascript is not a language for beginners.−mraison12y var tens = ['10','10','10','10','10','10','10','10'].map(parseInt); var ten = tens[tens.length-1]; var two = ten % 4; console.log(two + 2);
Comments
7 bytes: !''|2+2
:)
5 bytes: 1|2+2
I think all these bytes are not creative. !![]+2+2 ? !''|2+2 ? 1|2+2 ? Why the use of new operators? Why not just write 1+2+2 ?
Well if you made a general add function that always performed an or operation on the least significant bit, it would be pretty interesting. You'd always flip odd and even in any addition.
To make many more examples of why Javascript is not a language for beginners.