+ 5

Number() vs parseInt() ?

What's the difference between them ?

29th Jan 2017, 3:31 PM
AlamSirji
AlamSirji - avatar
5 ответов
+ 12
parseInt() is inherited from Java (mother language of JavaScript) and it's used to convert var to "int" data-type. Number() converts var automatically to most suitable numeric data-type……
29th Jan 2017, 3:37 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 12
java and javascript are different
3rd Jul 2017, 7:14 AM
Assylbek
Assylbek - avatar
+ 11
This answered my parseInt question...thanks
28th Apr 2017, 4:40 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 6
You can do conversion of non-decimal strings to decimal with parseInt(). For instance, parseInt("11001", 2)
29th Jan 2017, 4:11 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
<< A common misconception is that JavaScript is similar or closely related to Java. It is true that both have a C-like syntax (the C language being their most immediate common ancestor language). They also are both typically sandboxed (when used inside a browser), and JavaScript was designed with Java's syntax and standard library in mind. In particular, all Java keywords were reserved in original JavaScript, JavaScript's standard library follows Java's naming conventions, and JavaScript's Math and Date objects are based on classes from Java 1.0,[109] but the similarities end there. Java and JavaScript both first appeared on 23 May 1995, but Java was developed by James Gosling of Sun Microsystems, and JavaScript by Brendan Eich of NetScape Communications. The differences between the two languages are more prominent than their similarities. Java has static typing, while JavaScript's typing is dynamic. Java is loaded from compiled bytecode, while JavaScript is loaded as human-readable source code. Java's objects are class-based, while JavaScript's are prototype-based. Finally, Java did not support functional programming until Java 8, while JavaScript has done so from the beginning, being influenced by Scheme. >> https://en.m.wikipedia.org/wiki/JavaScript#JavaScript_and_Java
29th Jan 2017, 5:37 PM
visph
visph - avatar