OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Optional chaining on the left side in Javascript

  • Thread starter Thread starter Ma Jerez
  • Start date Start date
M

Ma Jerez

Guest
Is it possible to use the optional chaining operator in the left side of an assignment = in Javascript?

Code:
const building = {}
building?.floor?.apartment?.number = 3; // Is this possible?

<p>Is it possible to use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining" rel="noreferrer">optional chaining</a> operator in the left side of an assignment <code>=</code> in Javascript?</p>

<pre class="lang-js prettyprint-override"><code>const building = {}
building?.floor?.apartment?.number = 3; // Is this possible?
</code></pre>
 

Latest posts

Top