Create a type predicate function that checks if input's typeof matches one of the given types.
input
typeof
types
const isStringOrNumber = typeOf('string', 'number');isStringOrNumber('hello'); // trueisStringOrNumber(5); // trueisStringOrNumber(true); // false Copy
const isStringOrNumber = typeOf('string', 'number');isStringOrNumber('hello'); // trueisStringOrNumber(5); // trueisStringOrNumber(true); // false
Create a type predicate function that checks if
input'stypeofmatches one of the giventypes.