23JavaScript basics
JavaScript Operators
Easy20MIN
Variable values are often manipulated using various operators and functions. Below are some commonly used operators and functions:
Arithmetic operators
Used for mathematical calculations such as addition and subtraction, multiplication and division. For example, you can calculate the sum of two variables as follows:
JAVASCRIPT
1var x = 5;
2var y = 10;
3var sum = x + y;This calculates the sum of variables "x" and "y" and stores the result in a new variable named "sum".
1 / 5
Hakatemia Pro
Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.