Practice ยท 1 of 3
Shape Checker
Write hasShape(obj, spec) โ spec maps field names to expected typeof strings ("string", "number", "boolean"). RETURN true only when obj is a non-null object and every spec field exists with the exact typeof. Extra fields on obj are allowed (structural typing).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Shapes & Inference โ Practice