Javascript function similar to php empty function