Grokking Modern System Design Interview for Engineers & Managers
Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.
Math
in JavaScript is a built-in object that contains different methods and properties used to perform mathematical operations. It contains an abs()
function, which is used to compute a specified number’s absolute value. Absolute value is the number without a sign.
Math.abs(param);
param
: This is the input value of type Number
for which we want to find the abs()
.
Number
in JavaScript is a 64-bit double-precision value which is the same asdouble
in C# or Java.
Number
: It returns the absolute value of the given param
. If param
is negative, it returns positive param
, and returns the same if param
is already positive.
NaN
: The function returns NaN
if param
is one of the following:
0
: The function returns this if param
is one of the following:
console.log("abs('-1') = " + Math.abs('-1'));console.log("abs(-1) = " + Math.abs(-1));console.log("abs([1]) = " + Math.abs([-1]));console.log("abs('educative') = " + Math.abs('educative'));console.log("abs() = " + Math.abs());console.log("abs([1,-1]) = " + Math.abs([1,-1]));console.log("abs({}) = " + Math.abs({}));console.log("abs(null) = " + Math.abs(null));console.log("abs('') = " + Math.abs(''));console.log("abs([]) = " + Math.abs([]));
RELATED TAGS
CONTRIBUTOR
Grokking Modern System Design Interview for Engineers & Managers
Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.