A complete Guide for JavaScript Assignment Operators open this thread :
Assignment operators assign values to JavaScript variables. The assignment operator in JavaScript is denoted by the `=` symbol. Here, a is the variable and value is assigned to a. Let's deep dive into it in the next following threads.
Let's see first one Assignment operator:
Addition assignment: In JavaScript, the addition assignment operator is denoted by the `+=` symbol. This operator is a shortcut that allows you to add a value to a variable and then assign the result back to the same variable, all in one step. For example,
Subtraction assignment operator: In JavaScript, the subtraction assignment operator is denoted by the `-=` symbol. This operator is a shortcut that allows to subtract a value from a variable and then assign the result back to the same variable, all in one step same as +=
Multiplication assignment operator: In JavaScript, the multiplication assignment operator is denoted by the `*=` symbol. This operator is a shortcut that allows you to multiply a value by a variable and then assign the result back to the same variable, all in one step.
Division assignment operator: In JavaScript, the division assignment operator is denoted by the `/=` symbol. This operator is a shortcut that allows you to divide a variable by a value and then assign the result back to the same variable, all in one step.
Remainder assignment operator: In JavaScript, the remainder assignment operator is denoted by the `%=` symbol. This operator is a shortcut that allows you to compute the remainder of a variable divided by a value and then assign the result back to the same variable For example,
Exponentiation assignment operator: In JavaScript, the exponentiation assignment operator is denoted by the `**=` symbol. This operator is a shortcut that allows you to raise a variable to the power of a value and then assign the result back to the same variable. For example,
No comments:
Post a Comment
If you have any doubts or questions, please let us know.