Attempt at a javascript