Hi @Yunfei_Xie !!
yes, You’re correct that “int” and “float” are reserved words in many programming languages, including languages like Java and C#. However, in JavaScript, which is the language commonly used in web development, “int” and “float” are not reserved words. This means you can use them as variable names if you want to.
JavaScript has a single number type called “Number” which encompasses both integer and floating-point values. Unlike some other languages, JavaScript does not have explicit data types for integers and floating-point numbers.
In the code snippet you provided, “int” and “float” are simply variable names chosen by the programmer. They could have used any other valid variable name instead. The values assigned to these variables, 1
and 1.1
, are examples of numerical values in JavaScript.
I hope it helps. Happy Learning