+ 12
Java data types vs. JS
Why does java require so many different data types for numbers where JS just has "number".? Is there an advantage to one way over the other?
1 Antwort
+ 12
It's late and I'm lazy, so I just copied/pasted ^^
Source link below.
'Static vs Dynamic Type Checking.
Java uses static type checking, where the type of a variable is checked at compile-time. The programmer must specify the type (integer, double, string, etc.) of any variable they create.
JavaScript, like most scripting languages, uses dynamic typing, where type safety is verified at runtime. It is not required for a programmer to specify the type of any variable they create. There are many pros and cons for these two paradigms, but the primary advantage of static type checking is that type errors are caught early in development, and because the compiler knows exactly what data types are being used, code typically executes faster or uses less memory. The primary advantage of dynamic type checking is programmer productivity—you are free to assign types at your leisure.'
Source:
https://www.google.de/amp/s/www.upwork.com/hiring/development/java-vs-javascript/amp/