Returns a string indicating the type of the operand.
Syntax
typeof value === 'string' | 'number' | ...Example
Enter values below to update the example in real time.
function→padLeft→value→string→padding→if→typeof→return→function padLeft(value: string, padding: string | number) {
if (typeof padding === "number") {
return " ".repeat(padding) + value;
}
return padding + value;
}