Skip to main content
No longer use a variable for " rock,\n", no "var" at the beginning, while-loop without {}
Source Link
izlin
  • 1.6k
  • 1
  • 11
  • 18

Javascript - 140 132

k=1,s=", ",t=" o'clock",x="";while(k<11)x+=k+++s+k+++s+k+++t+s+k+++t+" rock,\n";alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Explanation

The k+++s is equal to (k++)+s, so it adds k first to x, then increments k and then it adds s to x. This process will be done three times before it adds the last sentence.

Javascript - 140 132

k=1,s=", ",t=" o'clock",x="";while(k<11)x+=k+++s+k+++s+k+++t+s+k+++t+" rock,\n";alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Javascript - 140 132

k=1,s=", ",t=" o'clock",x="";while(k<11)x+=k+++s+k+++s+k+++t+s+k+++t+" rock,\n";alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Explanation

The k+++s is equal to (k++)+s, so it adds k first to x, then increments k and then it adds s to x. This process will be done three times before it adds the last sentence.

No longer use a variable for " rock,\n", no "var" at the beginning, while-loop without {}
Source Link
izlin
  • 1.6k
  • 1
  • 11
  • 18

Javascript - 140140 132

var k=1,s=", ",t=" o'clock",u=" rock,\n",x="";while(k<11){x+=k+++s+k+++s+k+++t+s+k+++t+u}alertx+=k+++s+k+++s+k+++t+s+k+++t+" rock,\n";alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Javascript - 140

var k=1,s=", ",t=" o'clock",u=" rock,\n",x="";while(k<11){x+=k+++s+k+++s+k+++t+s+k+++t+u}alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Javascript - 140 132

k=1,s=", ",t=" o'clock",x="";while(k<11)x+=k+++s+k+++s+k+++t+s+k+++t+" rock,\n";alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

edited body
Source Link
izlin
  • 1.6k
  • 1
  • 11
  • 18

Javascript - 141140

var k=1,s=", ",t=" o'clock",u=" rock,\n",x="";while(k<11){x+=k+++s+k+++s+k+++t+s+k+++t+u}alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Javascript - 141

var k=1,s=", ",t=" o'clock",u=" rock,\n",x="";while(k<11){x+=k+++s+k+++s+k+++t+s+k+++t+u}alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Javascript - 140

var k=1,s=", ",t=" o'clock",u=" rock,\n",x="";while(k<11){x+=k+++s+k+++s+k+++t+s+k+++t+u}alert(x+"We're gonna rock around the clock tonight.")

The fact, that 11 is made out of two 1's let me pass the rules I guess.

Source Link
izlin
  • 1.6k
  • 1
  • 11
  • 18
Loading