Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

arithmetic expression javascript

function solution(a, b, c) {
    return a + b === c || a - b === c || a * b === c || a / b === c;
}
Comment

javascript Arithmetic operators

var additionOutput = 2 + 2; //addition
var subtractionOutput = 2 - 2; //subtraction
var multiplcationOutput = 2 * 2; //multiplcation
var divisionOutput = 2 / 2; //division
var exponentiation = 2**2; // Exponentiation
var modulus = 5 % 2; // Modulus (Remainder)
var unaryOperator = 1; 
++unaryOperator; // Unary Operator Increment // ++ , --
Comment

js arithmetic operators

a = 90 + 13; //Addition
b = 72 - 23; //Subtraction
c = 23 * 7; //Multiplication
d = 12 ** 3; //Exponentation
e = 123 / 3; //Division
f = 139 % 2; //Modulus
g++; //Increment
h--; //Decrement
Comment

Arithmetic operators in JavaScript

let x = 5;
let y = 3;

// addition
console.log('x + y = ', x + y);  // 8

// subtraction
console.log('x - y = ', x - y);  // 2

// multiplication
console.log('x * y = ', x * y);  // 15

// division
console.log('x / y = ', x / y);  // 1.6666666666666667

// remainder
console.log('x % y = ', x % y);   // 2

// increment
console.log('++x = ', ++x); // x is now 6
console.log('x++ = ', x++); // prints 6 and then increased to 7
console.log('x = ', x);     // 7

// decrement
console.log('--x = ', --x); // x is now 6
console.log('x-- = ', x--); // prints 6 and then decreased to 5
console.log('x = ', x);     // 5

//exponentiation
console.log('x ** y =', x ** y);
Comment

JavaScript Arithmetic Operators

Operator	Name	Example
+	Addition	x + y
-	Subtraction	x - y
*	Multiplication	x * y
/	Division	x / y
%	Remainder	x % y
++	Increment (increments by 1)	++x or x++
--	Decrement (decrements by 1)	--x or x--
**	Exponentiation (Power)	x ** y
Comment

javascript Arithmetic Operators

/*
  Arithmetic Operators
  + Addition
  - Subtraction
  * Multiplication
  / Division
  ** Exponentiation (ES7)
  % Modulus (Division Remainder)
  ++ Increment [ Post / Pre ]
  -- Decrement [ Post / Pre ]
*/

console.log(10 + 20);
console.log(10 + "Osama");

console.log(10 - 20);
console.log(10 - "Osama"); // NaN
console.log(typeof NaN);

console.log(10 * 20);
console.log(10 * -20);

console.log(20 / 5);
console.log(20 / 3);

console.log(2 ** 4);
console.log(2 * 2 * 2 * 2);

console.log(10 % 2);
console.log(11 % 2); // Remove 1
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery form data 
Javascript :: javascript remove first character from array list 
Javascript :: node module es6 
Javascript :: debounce js 
Javascript :: react bootstrap carousel caption placement top 
Javascript :: convert image object to blob javascript 
Javascript :: Radom String in Javascript 
Javascript :: ruby hash to json 
Javascript :: tolocaledatestring format dd-mm-yyyy 
Javascript :: header logo react native img 
Javascript :: Group array of strings by first letter 
Javascript :: get element innerhtml jquery 
Javascript :: list javascript 
Javascript :: sort nested data using sort function javascript 
Javascript :: javascript fs read 
Javascript :: moment get timezone 
Javascript :: how to add field to object in js 
Javascript :: get the most recent records in mongoose 
Javascript :: as it does not contain a package.json file. react 
Javascript :: referenceerror document is not defined node js 
Javascript :: continuous scrolling js 
Javascript :: js how to work with float 2 decimal numbers 
Javascript :: change class Name in react 
Javascript :: javascript remove space 
Javascript :: counts the duplicates in an array using for loop 
Javascript :: create an object array in js 
Javascript :: como diminuir quantidade de casas decimais javascript 
Javascript :: js string count 
Javascript :: js array to csv download 
Javascript :: accessing object properties with bracket notation 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =