forked from PatrickJS/angular-webpack-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.template-string.ts
More file actions
40 lines (29 loc) · 781 Bytes
/
4.template-string.ts
File metadata and controls
40 lines (29 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* With ES6 we finally have multi-line string support
*/
let prevouly = '\n'+
' <h1>Test</h1>\n'+
' <p>testing</p>\n'+
'';
console.log('template strings prevouly\n', prevouly)
// now we can use back-ticks
let now = `
<h1>Test</h1>
<p>testing</p>
`;
console.log('template strings now\n', now);
// we also get interpolation features
let feature = 'interpolation';
console.log(`testing out the new ${ feature } feature in ES6`)
console.log('---------------------------------------------');
}();
!function() {
console.log('---------------Default Arguments-------------');
/*
* With ES6 we can declare a default argument
*/
function returnText(text = 'default text') {
return 'return:\n' + text;
}
console.log(returnText());
console.log(returnText('now with text'));