Skip to main content
deleted 24 characters in body
Source Link
Cristian Lupascu
  • 8.7k
  • 2
  • 25
  • 52

JavaScript, 81 77 74 7470 bytes

Saved 4 bytes thanks to Shaggy

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a)alert,9,a)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a)alert,9,a)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a)alert,9,a)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a)alert,9,a)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a)alert,9,a)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a)alert,9,a)

JavaScript, 81 77 74 bytes

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

JavaScript, 81 77 74 70 bytes

Saved 4 bytes thanks to Shaggy

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(alert,9,a)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(alert,9,a)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(alert,9,a)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(alert,9,a)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(alert,9,a)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(alert,9,a)

deleted 15 characters in body
Source Link
Cristian Lupascu
  • 8.7k
  • 2
  • 25
  • 52

JavaScript, 81 77 7774 bytes

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeoutclearTimeout(t)
t=setTimeout(_=>alert(a),9)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeoutclearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeoutclearTimeout(t)
t=setTimeout(_=>alert(a),9)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeoutclearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeoutclearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeoutclearTimeout(t)
t=setTimeout(_=>alert(a),9)

JavaScript, 81 77 bytes

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

JavaScript, 81 77 74 bytes

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Source Link
Cristian Lupascu
  • 8.7k
  • 2
  • 25
  • 52

JavaScript, 81 77 bytes

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Pretty lame JS solution. Consumes the values from the [3,1,1] array from the right (pop()). Registers a timeout to display the current value in the future. If a timeout was already registered, cancel it. Relies on the dirty nature of var, which hoists variable declarations.

Two times:

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

Three times:

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)

var t,i=(i||[3,1,1]),a=i.pop()
t&&clearTimeout(t)
t=setTimeout(_=>alert(a),9)