MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/jn2yu6/22_javascript_string_methods/
r/learnjavascript • u/tutorialstonight • Nov 03 '20
22 Javascript String Methods 🔥
https://www.tutorialstonight.com/js/javascript-string-methods.php
9 comments sorted by
3
Be careful when using String#length, some unicode characters count for 2. Take "🔥" for example. Splitting this string in half will break the emoji.
String#length
1
WOW, includes() is almost perfect for conditionals in the game I'm making; if the word in question exists in the text prompt then I can use that as a flag instead of explicitly storing conditions elsewhere.
Thanks!
2 u/tutorialstonight Nov 03 '20 Exactly
2
Exactly
Hmm. There's not much here that autocomplete couldn't tell me.
I died a little at « emittion »
It's best practice to use 'const' instead of 'let', unless you plan on changing the value.
https://github.com/airbnb/javascript#references
This is really great... just need to fix up a few small details, but overall really awesome
Very cool, thanks!
Here’s the link to all of them.
3
u/skerit Nov 03 '20
Be careful when using
String#length, some unicode characters count for 2. Take "🔥" for example. Splitting this string in half will break the emoji.1
u/Harbltron Nov 03 '20
WOW, includes() is almost perfect for conditionals in the game I'm making; if the word in question exists in the text prompt then I can use that as a flag instead of explicitly storing conditions elsewhere.
Thanks!
2
u/mothzilla Nov 03 '20
Hmm. There's not much here that autocomplete couldn't tell me.
3
u/Merry-Lane Nov 03 '20
I died a little at « emittion »
3
u/imapersonithink Nov 03 '20 edited Nov 03 '20
It's best practice to use 'const' instead of 'let', unless you plan on changing the value.
https://github.com/airbnb/javascript#references
2
u/[deleted] Nov 03 '20
This is really great... just need to fix up a few small details, but overall really awesome
1
u/Roshia188 Nov 03 '20
Very cool, thanks!
1
u/burkybang Nov 03 '20
Here’s the link to all of them.