this post was submitted on 26 Jun 2023
366 points (98.9% liked)
Memes
45544 readers
1658 users here now
Rules:
- Be civil and nice.
- Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
LastName = Name[1]
The only right answer... But wouldn't
Name[1]
be 'e' in this case? I would add a.split(' ')
to avoid confusion.So the full answer would be
Name.split(' ')[1]
Why do I always over think stuff like this...
Edit: they also shouldn't capitalize variable names
https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
There's a reason I refuse to try parsing names as a string separated by spaces.
Separate fields, bitches.
Love me some JS brother
Could be the middle name though, better use name[name.length-1]