Skip to main content
added 41 characters in body
Source Link
Cyoce
  • 3.4k
  • 25
  • 29

JavaScript ES6, 6159 56

s=prompt()
alert((s.charCodeAt(0)- -s[1]^s[1])%2?"light":"dark")

Extracts the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

3 bytes saved thanks to Neil!

JavaScript ES6, 61

s=prompt()
alert((s.charCodeAt(0)- -s[1])%2?"light":"dark")

Extracts the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

JavaScript ES6, 59 56

s=prompt()
alert((s.charCodeAt()^s[1])%2?"light":"dark")

Extracts the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

3 bytes saved thanks to Neil!

added 4 characters in body
Source Link
Cyoce
  • 3.4k
  • 25
  • 29

JavaScript ES6, 61

s=prompt()
alert((s.charCodeAt(0)- -s[1])%2?"light":"dark")

AddsExtracts the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

JavaScript ES6, 61

s=prompt()
alert((s.charCodeAt(0)- -s[1])%2?"light":"dark")

Adds the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

JavaScript ES6, 61

s=prompt()
alert((s.charCodeAt(0)- -s[1])%2?"light":"dark")

Extracts the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

deleted 202 characters in body; edited body; added 131 characters in body
Source Link
Cyoce
  • 3.4k
  • 25
  • 29

JavaScript ES6, 4461

s=>s=prompt()
alert((s.charCodeAt(0)- -s[1])%2?"light":"dark")

Adds the number and the ASCII code of the letter, adds them and checks if even/odd. This creates an arrow function that takescan accept input as a string. Note: it cannot technically be called in thisthe form, as there is no way to reference it. To fix this, add l=a1 at the beginning, and then call it like l("a1")A1

JavaScript ES6, 44

s=>(s.charCodeAt(0)- -s[1])%2?"light":"dark"

This creates an arrow function that takes input as a string. Note: it cannot technically be called in this form, as there is no way to reference it. To fix this, add l= at the beginning, and then call it like l("a1")

JavaScript ES6, 61

s=prompt()
alert((s.charCodeAt(0)- -s[1])%2?"light":"dark")

Adds the number and the ASCII code of the letter, adds them and checks if even/odd. This can accept input in the form a1 and A1

added 4 characters in body
Source Link
Cyoce
  • 3.4k
  • 25
  • 29
Loading
Source Link
Cyoce
  • 3.4k
  • 25
  • 29
Loading