You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.`obj?.prop`-- devuelve `obj.prop` si `obj` existe, si no, `undefined`.
167
-
2.`obj?.[prop]`-- devuelve `obj[prop]` si `obj` existe, sino`undefined`.
167
+
2.`obj?.[prop]`-- devuelve `obj[prop]` si `obj` existe, si no,`undefined`.
168
168
3.`obj?.method()`-- llama a `obj.method()` si `obj` existe, sino devuelve `undefined`.
169
169
170
170
Como podemos ver, todos ellos son sencillos y fáciles de usar. El`?.` comprueba la parte izquierda para `null/undefined` y permite que la evaluación continúe si no es así.
0 commit comments