Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Unexpected assignment within ConditionalExpression

I am trying to update a lib I got from GitHub and there is a strange condition I have never seen before, can someone help me understand what is this? As I understand _c = _b === null means that _c get's a value of true or false... and later on _c !== undefined will always be true.. am I missing something?

  const _b = { isWrappable: true, insertedTag: false };
  let _c;
  const status = (_c = _b === null || _b === undefined ? undefined : _b.isWrappable) !== null && _c !== undefined ? _c : false;
  console.log(status);

after this line status is true

Now, how can I change this line to avoid Unexpected assignment within ConditionalExpression. because everything I tried gives me false, for example:

  const _b = { isWrappable: true, insertedTag: false };
  const _c = _b === null;
  const test = (_c || _b === undefined ? undefined : _b.isWrappable) !== null && _c !== undefined ? _c : false;
  console.log(test);

  • _b is a variable, it can be null or undefined sometimes

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I've solved it :) in my research I found Nullish coalescing operator (??) and solved my problem So the answer is

const _b = {
  isWrappable: true,
  insertedTag: false
};
const status = _b?.isWrappable ?? false;
console.log(status);

The optional chaining operator and Nullish coalescing operator solved that mess.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!