Closed linusg closed 5 years ago
Ah, and template strings are a much cleaner way of string concatenation than the +
operator :wink:
"ws://" + location.host + "/ws"
`ws://${location.host}/ws`
Thank you Linus for comments. I'll try to fix the indentation in the next release. As for concatenation it's just easier for me - it works the same way almost in all languages :)
On Thu, Jan 24, 2019 at 1:51 AM Linus Groh notifications@github.com wrote:
Ah, and template strings https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/template_strings are a much cleaner way of string concatenation than the + operator 😉
"ws://" + location.host + "/ws"
ws://${location.host}/ws
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/project-owner/Peppy/pull/3#issuecomment-457135135, or mute the thread https://github.com/notifications/unsubscribe-auth/APyAdD-zCRPEccIVu-4R-QOtSTIiq5ODks5vGYI9gaJpZM4aQf3d .
if (arg != null)
should beif (arg !== undefined)
orif (arg)
Don't get me wrong, the code worked, but not as one may think. Consider the following self-executing anonymous function:
You'll see the output is:
Which means:
arg
, for which no value was passed to the function, isundefined
, notnull
undefined != null
still evaluates tofalse
- see https://stackoverflow.com/a/359509/5952681!==
identity operator won't do an implicit type conversion, soundefined !== null
evaluates totrue
, as expected.As a shortcut
if (arg)
can be used, though.Last but not least, as I told you in the German Raspberry Pi forum before, this is an awesome project! 😃