79136045

Date: 2024-10-29 06:35:18
Score: 1.5
Natty:
Report link

Just use "?", so if there's value it will return otherwise you will not get null value error.

const sodas = Number(document.querySelector('input[name = soda]:checked')?.value);
console.log(sodas);

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Usama Kayani