Skip to main content
๐Ÿ› Bug HuntTS TypeScript Medium+20 XP

Null Check Missing

This crashes when user is null.

๐Ÿ› Find the bug
1function getNameLength(user: { name: string } | null) {
2 return user.name.length;
3}
๐Ÿ› The bug is on line 2

๐Ÿ”ง Select the correct fix:

Priygop - Leading Professional Development Platform | Expert Courses & Interview Prep