Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Add basic es6
Browse files Browse the repository at this point in the history
  • Loading branch information
sicktastic committed Sep 1, 2017
1 parent bc1a496 commit 3cf1189
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Empty file added es6/default-parameters.js
Empty file.
9 changes: 9 additions & 0 deletions es6/ends-with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

let strToSearch = 'a-really-long-hyphenated-string';

console.log(/hyphenated-string$/.test(strToSearch)); // test string w/ regular expression

console.log(strToSearch.indexOf('hyphenated-string') === strToSearch.length - 'hyphenated-string'.length); // indexOf

console.log(strToSearch.endsWith('hyphenated-string', 21)); // endsWith
9 changes: 9 additions & 0 deletions es6/includes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

let strToSearch = 'a-really-long-hyphenated-string';

console.log(/long/.test(strToSearch)); // test string w/ regular expression

console.log(strToSearch.indexOf('long') > -1); // indexOf

console.log(strToSearch.includes('long')); // includes
9 changes: 9 additions & 0 deletions es6/starts-with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

let strToSearch = 'a-really-long-hyphenated-string';

console.log(/^a-really/.test(strToSearch)); // test string w/ regular expression

console.log(strToSearch.indexOf('a-really') === 0); // indexOf

console.log(strToSearch.startsWith('lly', 5)); // startsWith

0 comments on commit 3cf1189

Please sign in to comment.