New String Functions

var message = 'Hello World'; message.startsWith('H'); // instead of message.indexOf('H') === 0 message.endsWith('d'); // instead of whatever ¯\_(ツ)_/¯ message.includes('or'); // instead of message.indexOf('or') >= 0 // There is a helper for repeating character n times. // ES5 - Previously you would have done new Array(3+1) * '*' // ES6 - Now you can simply do '*'.repeat(3); // Will generate ***

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.