Javascript isn't among the languages officially supported by Godot. If your question is about faking a mouse click event in Godot, the (GDScript-)answer would be:
var fake_input = InputEventMouseButton.new()
fake_input.button_index = BUTTON_LEFT
fake_input.doubleclick = false
fake_input.pressed = true
get_tree().input_event(fake_input)