Create a function coercionAddition that adds true + 2 and logs the result and its type.
basicArithmetic
about 1 year agoCreate a function basicArithmetic that adds, subtracts, multiplies, divides, and uses modulus on two numbers and logs each result.
decrementOperator
about 1 year agoCreate a function decrementOperator that declares a variable, decrements it using --, and logs the result.
incrementOperator
about 1 year agoCreate a function incrementOperator that declares a variable, increments it using ++, and logs the result.
assignmentOperator
about 1 year agoCreate a function assignmentOperator that uses += and *= on a number and logs the result after each operation.
comparisonOperators
about 1 year agoCreate a function comparisonOperators that compares two numbers using >, <, ==, and ===. Log each result.
ternaryOperator
about 1 year agoCreate a function ternaryOperator that checks if a number is even or odd using the ternary operator and logs the result.
logicalOperators
about 1 year agoCreate a function logicalOperators that uses && and || to combine two boolean variables and logs the result.
typeCoercion
about 1 year agoCreate a function typeCoercion that adds a number and a string together, then logs the result and its type.
multiplyAndAdd
about 1 year agoCreate a function multiplyAndAdd that multiplies two numbers and adds a third number to the result. Log the final value.
postPreIncrement
about 1 year agoCreate a function postPreIncrement that shows the difference between post-increment and pre-increment.
logicalNot
about 1 year agoCreate a function logicalNot that takes a boolean and logs the opposite using the ! operator.
compoundAssignment
about 1 year agoCreate a function compoundAssignment that shows the use of -= and /= operators on a number.
strictVsLooseEquality
about 1 year agoCreate a function strictVsLooseEquality that compares '5' and 5 using == and === and logs the results.
nestedTernary
about 1 year agoCreate a function nestedTernary that logs 'positive', 'zero', or 'negative' depending on the input number.
coercionAddition
about 1 year agoCreate a function coercionAddition that adds true + 2 and logs the result and its type.