• Great... So literally just:

    // you had this
    var page = '<html><body><script>var ws;setTimeout(function(){';
    page += 'const ws = new WebSocket("ws://" + location.host);';
    page += 'ws.onmessage = function (event) { console.log("MSG:"+event.data); };';
    page += 'setTimeout(function() { ws.send("Hello to Espruino!"); }, 1000);';
    page += '</script><p>something</p></body></html>­';
    // You can do this:
    var page = `<html><body><script>var ws;setTimeout(function(){
    const ws = new WebSocket("ws://" + location.host);
    ws.onmessage = function (event) { console.log("MSG:"+event.data); };
    setTimeout(function() { ws.send("Hello to Espruino!"); }, 1000);
    </script><p>something</p></body></html>`­;
    

    It's just tidier, and especially if you're writing more HTML it'll make things a lot easier :)

About

Avatar for Gordon @Gordon started