Skip to content

Instantly share code, notes, and snippets.

@release-please
release-please / es6strings.js
Created June 6, 2017 16:41
es6 Strings with Destruct
let check = function(strings, ...values) {
console.log(strings, values);
if (values[0] < 24) {
values[1] = 'awake';
}
return `${strings[0]}${values[0]}${strings[1]}${values[1]}`;
};
let message = check`Its ${new Date().getHours()} and Im ${'sleepy'}`;