Practical guides, tutorials, and insights from years of building web and desktop applications. Check out code examples you can actually use!
ES6 String Operations That Rock the World
There are many great improvements provided by ES6 (introduced in Y2015), but I think a couple of them are really cool. String includes includes checks whether a certain (sub) string exists in the provided string. Note that this operation is case sensitive. let str1 = "Neo rocks the world"; console.log("rocks? ", str1.includes("rocks")); // rocks? true console.log("is agent? ", str1.includes("agent")); // is agent? false Not quite complicated, but makes the language that much more friendly :) Earlier, we used a very complicated piece of code to achieve the same result. ...