Values in JavaScript
JavaScript has various value types including strings, numbers, booleans, etc. Here are a few basic examples.
To run the program, save it as values.js
and use node
:
In JavaScript, all numbers are floating-point values, so there’s no distinction between integers and floats as in some other languages. The arithmetic operations work similarly, but keep in mind that due to the nature of floating-point arithmetic, some operations might produce slightly different results compared to languages with separate integer types.
Boolean operations in JavaScript work just like in many other programming languages, with &&
for AND, ||
for OR, and !
for NOT.
JavaScript uses console.log()
for printing to the console, which is analogous to fmt.Println()
in other languages.