javascript battle plan