Yo ninjas, I just want to show you a couple of neat little string methods (functions) in this JavaScript tutorial. The slice method and the split method. The slice method literally ‘slices’ your string into a new segment defined by starting and ending points. The split method, splits a string into multiple ‘pockets’ and puts them into an array (great for splitting tags).
As always, any questions, fire away below :).
SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
========== JavaScript for Beginners Playlist ==========
========== CSS for Beginners Playlist ==========
========== HTML for Beginners Playlist ==========
========== The Net Ninja ============
For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk
========== Social Links ==========
Twitter – @TheNetNinja – https://twitter.com/thenetninjauk
Original source
17 responses to “JavaScript Tutorial For Beginners #25 – Slice and Split Strings”
u really like meat so much.
always meat examples lmao
Im eating a cake while watching this video and I can really taste the layer! Okay i'll stop…
how would you do this with shapes
sure feeling like having a little prok right now!
so helpfull
I love how short and simple these vids are. Thanks
HEY NET NINJA, how do i split let alphabet = "abcdefghijklmnopqrstuvwxyz" into a single character with space [let alphabet1= alphabet.split(" ") ; ] is not working
Cannot read property 'slice' of null
this is printing on my developers tool
for now, js is almost exactly like php..
is the mozilla page link in description missing.
the best explanation of arrays
You save me <3
tagsarray[0] =meat
tagsarray[1] =ham
tagsarray[2] =salami
…… All love!
This tutorial made me hungry for prok~!
But, f'reals though, you and the tutorials you make are awesome!
A very nice balance of thorough, to-the-point lecturing, and light-hearted feels.
Please keep doing what you do! <3
Awesome, thanks for sharing.
Hi, and what is when i want to slice the string from backwards?
How can we strip out the leading spaces from array positions >0?
what about negative slice numbers?