One JavaScript Trick You Should Know Want cleaner, shorter code? Use Optional Chaining (?.) Instead of writing: if (user && user.profile) { console.log(user.profile.email); } Just write: console.log(user?.profile?.email); This avoids errors if the property doesn’t exist! #JavaScript #CodingTips #Codermaniaa
0
0
3
11
0
Download Image