Last active
April 3, 2017 08:38
-
-
Save crongro/378a681146389d3ed04d7c98b56859b7 to your computer and use it in GitHub Desktop.
es6_template_literal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fn(val, name, hour) { | |
var ampm = (hour > 11) ? "pm" : "am"; | |
console.log(val[0], name, val[1], hour, ampm, val[2]); | |
} | |
var data = { | |
hour : new Date().getHours(), | |
name : "solvin" | |
} | |
const template = fn`<div><span>hello! ${data.name}, current time is ${data.hour}</span></div>`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment