Are you 100% sure that your connection details (see your 1st code share in your first post) are correct? I understand that what you posted here is mocked up, but check in your actual code.
I would suggest to try this code (a bit simpler than yours):
var wifi = require("Wifi");
wifi.connect("ssid", {password:"password"}, function(){ console.log("connected"); });
Then wait for "connected" message.
Also, make sure you do a wifi.save() to make sure that wifi settings are saved for after a power cycle.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Are you 100% sure that your connection details (see your 1st code share in your first post) are correct? I understand that what you posted here is mocked up, but check in your actual code.
I would suggest to try this code (a bit simpler than yours):
Then wait for "connected" message.
Also, make sure you do a wifi.save() to make sure that wifi settings are saved for after a power cycle.