Code tests done for Klarna as a JS evaluation test, total time: ~1h 30m
Implement a credit card masker that replaces all but the 1st and last 4 digits in the provided sequence
Should not mask input shorter than 6 characters
Should not mask non-numeric characters
Implement a number to ordinal method that returns a string
Input constraint is 0 to 10,000
Implement a calculator that accepts an expression as a string and performs the calculations
Expressions should be evaluated such that a operation will operate on the previous 2 numbers
Assumption can be made that an expression provided will always be valid
Valid operations are +
-
/
*
If no operations are provided, the last value in the expression should be returned
Should return 0 if no expression is provided