JavaScript tips - The void operator

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024
  • The void operator in JavaScript is a unary operator that evaluates an expression but then discards the result to instead return undefined
    This is a specialized operator that you may not use everyday but can be helpful in specific situations. One common use is with arrow functions to make sure the arrow function returns undefined instead of leaking a return value
    You'll also see 'void(0)' often used in minified code to get 'undefined' with fewer characters
    developer.mozi...
    #javascript
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 3