!wiDNXXSQXxtlDEsUqX:matrix.org

General

35 Members
MidlandsJS general chat1 Servers

Load older messages


SenderMessageTime
7 May 2021
@_slack_midlandsjs_U01KUGVLR9P:matrix.orgAndrew Holloway-Breward this is nothing to do with AWS I hasten to add 11:33:05
@_slack_midlandsjs_U01KUGVLR9P:matrix.orgAndrew Holloway-Breward are you available on a day rate basis to provide some assistance? 11:35:39
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood
In reply to@_slack_midlandsjs_U01KUGVLR9P:matrix.org
are you available on a day rate basis to provide some assistance?
I take it this is part of some company private IP project? I'd be more than happy to look at code if it's open source.
11:49:22
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood
In reply to@_slack_midlandsjs_U01BT7TF10Q:matrix.org
I take it this is part of some company private IP project? I'd be more than happy to look at code if it's open source.
It's possible for me to do an official consultancy + invoice gig but I really want to see if you can solve it without going down that route
11:50:16
@_slack_midlandsjs_U01KUGVLR9P:matrix.orgAndrew Holloway-Breward
In reply to@_slack_midlandsjs_U01BT7TF10Q:matrix.org
It's possible for me to do an official consultancy + invoice gig but I really want to see if you can solve it without going down that route
Hi David, yes it's a commercial project I'll email you offline
12:09:05
@_slack_midlandsjs_U01SF8RUSEL:matrix.orgAJImage from iOS
Download Image from iOS
13:20:44
@_slack_midlandsjs_U01SF8RUSEL:matrix.orgAJImage from iOS
Download Image from iOS
13:20:45
@_slack_midlandsjs_U01SF8RUSEL:matrix.orgAJ Hi all, just looking for some help in understanding what is going on here (JS newbie). I’m using JSfiddle.net as my IDE. I have created an array for storing names. If I declare the variable with var the name.length count is 28 but when I use let the count is 6. See attached screen shots... What is the reasoning for this? Any suggestions would be super helpful. Thanks in advance. 13:20:46
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood I am guessing what you're experiencing is a scope issue. If you did console.log(name) I bet you see a function name 13:28:08
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood It's wise to always use const and only use let if you know you need to change a variable's reference. Using var is rarely a good idea. 13:28:50
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owen That would be thanks to good ol' type coercion AJ and the nature of var being globally scoped 13:28:51
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owenimage.png
Download image.png
13:30:49
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owen https://developer.mozilla.org/en-US/docs/Web/API/Window/name there is a property on the window object called name which is a string and when you declare a variable using var it appears to be coercing the array with the string and in turn making one long string 13:30:49
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owen (edited) ... in tern making ... => ... in tuirn making ... 13:30:55
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owen (edited) ... in tuirn making ... => ... in turn making ... 13:31:00
@_slack_midlandsjs_UDZMMTT1Q:matrix.orgDan Jordan > Note: window.name converts all stored values to their string representations using the toString method. 13:38:05
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owen And there's the answer as to why that specifically happens :badjoke: 13:38:26
@_slack_midlandsjs_UHQBJBZ6W:matrix.orgMatt Owen (edited) ... answer :badjoke: => ... answer as to why that specifically happens :badjoke: 13:38:35
@_slack_midlandsjs_UDZMMTT1Q:matrix.orgDan Jordan moral of the story: don’t use var 13:39:10
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood Or, to be better protected from issues such as these, use const 13:39:41
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood Although it's worth noting that an array is stored by reference so any actions on it (array.push(...)) mutate the value, so const only helps when scoping 13:40:44
@_slack_midlandsjs_UDZMMTT1Q:matrix.orgDan Jordan The issue doesn’t happen with let so I wouldn’t mandate usage of const. 13:44:43
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood let and const work in the same way with capturing scope, so you can use either. I didn't mandate the use of const 13:45:28
@_slack_midlandsjs_U01BT7TF10Q:matrix.orgDavid Wood I'm preferring const and suggesting it here for other reasons, as a rule of thumb 13:45:57
@_slack_midlandsjs_UDZMMTT1Q:matrix.orgDan Jordan Ah my bad, the way you wrote it made me think you were suggesting const over let, but you are right they work the same way in this instance. 13:52:14
@_slack_midlandsjs_U01SF8RUSEL:matrix.orgAJ Thanks David Wood, Matt Owen and Dan Jordan for taking the time to reply (super appreciated). Totally forgot about functional and global scopes 🤦‍♂️. Need to get into the habit of writing let and const variables (where the variable does not need to be made available to the parent block - even then I get the impression it should be used sparingly). Have a great weekend! 15:49:50
10 May 2021
@_slack_midlandsjs_UP3S1QZPT:matrix.org_slack_midlandsjs_UP3S1QZPT joined the room.08:04:37
12 May 2021
@_slack_midlandsjs_U021UDJ6P28:matrix.orgIan Fitzgerald joined the room.07:59:52
@_slack_midlandsjs_U021UDJ6P28:matrix.orgIan Fitzgerald changed their display name from _slack_midlandsjs_U021UDJ6P28 to Ian Fitzgerald.07:59:52
@_slack_midlandsjs_U021UDJ6P28:matrix.orgIan Fitzgerald set a profile picture.07:59:53

There are no newer messages yet.


Back to Room List