This are also called ternary operator. This operators are conditional logic in which condition is evaluated and returns the conditional logic.
Syntax Condition? true-result? false-result;
The condition is an expression which is evaluated first. if the condition is true, true-result is evaluated if the condition is false, false-result is evaluatedWe will see the example
Even Number check using the ternary operator
var number1 = 15;
var number2= 16;
console.log(number1 %2 ? "Even Number" : "Odd Number"); // returns Even Number
console.log(number2 %2 ? "Even Number" : "Odd Number"); // returns Odd Number
This is also called string append operators which are operated on strings and symbol is + (plus). Appends the strings from the right side and assign to the left side. It does not add any extra space as part of string concat operations
var appendTest = "Concat"+" values"
console.log(appendTest) // returns Concat values
plus operator can be applied to multiple strings and append the strings and returns the concatenated string
This operator changes the sign of a number and symbol is -(minus) if the value is positive, negation returns negative if the value is negative negation returns positive
var number1 = 8;
console.log(number1); //returns 8
console.log(-number1); // returns -8
both operators are unary operators. So these operators have only single operand typeOf operator returns data type of the value instaceOf operator checks if the specified object is of the generic object type or not. Please see this Complete typeOf,Instanceof examples post for more examples.Examples
var strinTest ='test'
console.log(typeof strinTest); //returns : string