r/javascript • • Sep 18 '22

New Strings Method in ES6 JavaScript

https://techynidhi.hashnode.dev/new-strings-method-in-es6-javascript
0 Upvotes

17 comments sorted by

18

u/PooSham Sep 18 '22

Very straightforward. But those aren't really new anymore, es6 has been out there since 2015.

1

u/__Disaster497 Sep 22 '22

Yeah, It's my first time so, I just started writing πŸ˜ŠπŸ™Œ

8

u/anlumo Sep 18 '22

Well, straight to the point. Maybe explaining what they actually do and showing some examples would be nice, although in this case it's pretty self-explanatory.

1

u/__Disaster497 Sep 22 '22

Thanks for the suggestion, it's my first time so, I just wrote that I would be able to understand πŸ˜…πŸ™Œ

8

u/yo-chill Sep 18 '22

Why use

 `${name}`.method()

Instead of just

 name.method()

6

u/xroalx Sep 18 '22

Well, using template literal will convert name to string if it isn't already, which might be useful in certain cases, but if we know it's a string already there's really no point at all.

2

u/senocular Sep 19 '22

Unless it's a symbol. String(name) would be safer.

1

u/__Disaster497 Sep 22 '22

Thanks for the suggestion, I will keep in mind next time 😁🀝

8

u/__Disaster497 Sep 18 '22

The first article I have ever written πŸ˜…πŸ™Œ. Suggest to me, How I can improve though.

Thank You!!!

2

u/naruda1969 Sep 18 '22

I learned some things so thanks

1

u/__Disaster497 Sep 22 '22

It's pleasure for me that u liked it, tysm 😊🀝

3

u/BrokenLinc Sep 18 '22

Very clear and to the point, I enjoyed it! Some additional use cases might be good. For example, can you use matching strings longer than one character? Showing how to use β€œposition” with β€œincludes”, etc. Nice work!

1

u/__Disaster497 Sep 22 '22

Thank you so much, I'm very pleased that u liked it πŸ˜πŸ™Œ

2

u/Teddy_Bones Sep 18 '22

Nice article! πŸ™‚

1

u/__Disaster497 Sep 22 '22

Thanks πŸ˜ŠπŸ™Œ

2

u/No-One-5919 Sep 18 '22

Would be good if you add some description such as:

string methods are way to manipulate and do certain operations on strings.

0

u/[deleted] Sep 18 '22

[deleted]

1

u/__Disaster497 Sep 22 '22

Lol...maybe πŸ˜… Btw, sorry it's my first time so, just I have started, also thanks for the consern πŸ™Œ