0

After running console.log(69) and console?.log(69) getting 69 as output. What is use of '?' ?

  • A dupe that points to a dupe that points to a dupe... – Déjà vu May 29 '21 at 12:57
  • This is the final target https://stackoverflow.com/questions/32139078/null-safe-property-access-and-conditional-assignment-in-es6-2015 Let me check if I can get someone with a golden hammer – Sagar V May 29 '21 at 13:01
  • The '?' operator checks if the object exists, and only if it is true he continues to the next property. In this case - the 'console' object always exists so the 'log' property always going to work. console?.log(69) is shorter syntax to: if(console) console.log(69) – Dor Ben Itzhak May 29 '21 at 13:08

0 Answers0