LoginSignup
0
0

More than 5 years have passed since last update.

Ruby,Node.js真偽値を得る方法7選

Posted at
ruby
puts (!0)
#=>false
puts (!1)
#=>false
puts (!!0)
#=>true
puts (!!1)
#=>true
puts (!"")
#=>warning string literal in condition
#=>false
puts (![])
#=>false
puts (!{})
#=>false
Node.js
console.log(!0)
//=>true
console.log(!1)
//=>false
console.log(!!0)
//=>false
console.log(!!1)
//=>true
console.log(!"")
//=>true
console.log(![])
//=>false
console.log(!{})
//=>false
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0