Skip to main content
Added ES6 example, and removed uneccesary semicolons.
Source Link

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
s="a";while(s.length<32)s+=s;s+=s
for(s="a";s.length<32;s+=s);
for(s="aa",i=4;i--;s+=s);
s="aaaaaaaa",s+=s,s+=s;s+=s
s="aaaaaaaa",s+=s+s+s;s+=s+s+s
Array(33).join("a");

With ES6, this becomes even shorter:

'a'.repeat(32)

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
s="a";while(s.length<32)s+=s;
for(s="a";s.length<32;s+=s);
for(s="aa",i=4;i--;s+=s);
s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;
Array(33).join("a");

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
s="a";while(s.length<32)s+=s
for(s="a";s.length<32;s+=s)
for(s="aa",i=4;i--;s+=s)
s="aaaaaaaa",s+=s,s+=s
s="aaaaaaaa",s+=s+s+s
Array(33).join("a")

With ES6, this becomes even shorter:

'a'.repeat(32)

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Mod Removes Wiki by Doorknob
deleted 4 characters in body
Source Link
ajax333221
  • 3.7k
  • 3
  • 25
  • 29

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
s="a";while(s.length<32)s+=s;
for(s="a";s.length<32;s+=s);
for(s="aa",i=4;i--;s+=s);
new s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;
Array(33).join("a");
s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
s="a";while(s.length<32)s+=s;
for(s="a";s.length<32;s+=s);
for(s="aa",i=4;i--;s+=s);
new Array(33).join("a");
s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
s="a";while(s.length<32)s+=s;
for(s="a";s.length<32;s+=s);
for(s="aa",i=4;i--;s+=s);
s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;
Array(33).join("a");

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Rollback to Revision 1
Source Link
ajax333221
  • 3.7k
  • 3
  • 25
  • 29

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
s="a";while(s.length<32)s+=ss+=s;
for(s="a";s.length<32;length<32;s+=s)s+=s;
for(s="aa",i=4;i--;;s+=s)s+=s
s="aaaaaaaa",s+=s,s+=s
s="aaaaaaaa",s+=s+s+s;
new Array(33).join("a");
s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
s="a";while(s.length<32)s+=s
for(s="a";s.length<32;)s+=s
for(s="aa",i=4;i--;)s+=s
s="aaaaaaaa",s+=s,s+=s
s="aaaaaaaa",s+=s+s+s
Array(33).join("a")

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

Repeated characters

Be creative when trying to repeat the same character:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
s="a";while(s.length<32)s+=s;
for(s="a";s.length<32;s+=s);
for(s="aa",i=4;i--;s+=s);
new Array(33).join("a");
s="aaaaaaaa",s+=s,s+=s;
s="aaaaaaaa",s+=s+s+s;

Note: It is unlikely that you use it to form a string, but the idea can be applied to form large numbers too

added 10 characters in body
Source Link
Shmiddty
  • 1.2k
  • 7
  • 16
Loading
Source Link
ajax333221
  • 3.7k
  • 3
  • 25
  • 29
Loading