Skip to content

Instantly share code, notes, and snippets.

@vinicius73
Last active December 14, 2017 19:36
Show Gist options
  • Save vinicius73/6259eb4feb1ac0438fcb6b3c392f0a62 to your computer and use it in GitHub Desktop.
Save vinicius73/6259eb4feb1ac0438fcb6b3c392f0a62 to your computer and use it in GitHub Desktop.
Um exercício simples com js

Default true

Existem 3 entradas possiveis

  • true
  • false
  • undefined

as saídas serão:

  • undefinded => true
  • true => true
  • false => false

Crie uma função que avalie essas condições em apenas 1 (uma) linha   O objetivo é gerar o menor código possivel.

Solução

value => !(value === false)

// uglify
x => !(x === !1)

Parabéns @fmsouza

@vinicius73
Copy link
Author

Mandou muito bem @theuves
image

@jpcrs
Copy link

jpcrs commented Dec 14, 2017

x => x!=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment