Skip to main content
added 212 characters in body
Source Link
Cyoce
  • 3.4k
  • 26
  • 29

Use valueOf to make shorter function calls. Instead of:

function f(){...} f() 

use

f={valueOf:function(){...}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter__('f',function(){...}) f 

This trick also works for a function that takes 1 argument.

function f(v){...} f(x) 

Becomes

__defineSetter__('f',function(v){...}) f=x 

But now it will always return v.


Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 

use

f={valueOf:function(){}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter__('f',function(){}) f 

Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

Use valueOf to make shorter function calls. Instead of:

function f(){...} f() 

use

f={valueOf:function(){...}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter__('f',function(){...}) f 

This trick also works for a function that takes 1 argument.

function f(v){...} f(x) 

Becomes

__defineSetter__('f',function(v){...}) f=x 

But now it will always return v.


Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

deleted 1 character in body; added 33 characters in body
Source Link
Cyoce
  • 3.4k
  • 26
  • 29

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 
function f(){} f() 

use

f={valueOf:function(){}} +f 
f={valueOf:function(){}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter('f',function(){})__ f 
__defineGetter__('f',function(){}) f 

Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 

use

f={valueOf:function(){}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter('f',function(){})__ f 

Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 

use

f={valueOf:function(){}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter__('f',function(){}) f 

Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

added 27 characters in body
Source Link
Cyoce
  • 3.4k
  • 26
  • 29

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 

use

f={valueOf:function f(){} g={valueOf:f} +g+f 

If you call the function f frequently enough, you will save characters because +g+f is 1 shorter than f().

If you usef even more than that, you can use __definegetter('f',f)__ and then just write f__defineGetter__:

__defineGetter('f',function(){})__ f 

Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 

use

function f(){} g={valueOf:f} +g 

If you call the function f frequently enough, you will save characters because +g is 1 shorter than f().

If you usef even more than that, you can use __definegetter('f',f)__ and then just write f


Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

Use valueOf to make shorter function calls. Instead of:

function f(){} f() 

use

f={valueOf:function(){}} +f 

If you call the function f frequently enough, you will save characters because +f is 1 shorter than f().

If you usef even more than that, you can use __defineGetter__:

__defineGetter('f',function(){})__ f 

Edit: I forgot to mention this, but it only works for a function that doesn't take arguments.

deleted 6 characters in body
Source Link
Cyoce
  • 3.4k
  • 26
  • 29
Loading
added 105 characters in body
Source Link
Cyoce
  • 3.4k
  • 26
  • 29
Loading
deleted 4 characters in body; deleted 3 characters in body; added 106 characters in body
Source Link
Cyoce
  • 3.4k
  • 26
  • 29
Loading
Source Link
Cyoce
  • 3.4k
  • 26
  • 29
Loading