Skip to content

Instantly share code, notes, and snippets.

@IgorDePaula
Forked from vinicius73/problema.md
Created February 17, 2017 16:33
Show Gist options
  • Save IgorDePaula/a46dc102eb640cfe4078eb518b9a44de to your computer and use it in GitHub Desktop.
Save IgorDePaula/a46dc102eb640cfe4078eb518b9a44de 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.

@IgorDePaula
Copy link
Author

IgorDePaula commented Feb 17, 2017

const defaultTrue = (entrada) => entrada === false ? false : true

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