Brendan Eich , while creating Javascript took a great influence from Java.
In fact he was asked to create the Java language on the browser by the company Netscape.
So though Javascript has a lot of similarities with Java , it varies widely in other aspects.
With respect to numbers , Javascript treats Numbers differently from Java in these ways:
- All numbers are floating point numbers in Javascript
- You can represent 'Not a Number' in Javascript
- You can represent Infinity in Javascript
- You can convert a string to number using the '+' symbol in Javascript.
Explained with examples here:
https://fullstackdeveloper.guru/2021/04/30/how-do-numbers-differ-in-javascript-and-java/
Top comments (0)