31 lines
		
	
	
		
			592 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			31 lines
		
	
	
		
			592 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|   | --- | ||
|  | title: Template Literals | ||
|  | --- | ||
|  | 
 | ||
|  | Template Literals are an ES6 feature utilizing the backtick charater to define a string value | ||
|  | 
 | ||
|  | ### The basic syntax
 | ||
|  | 
 | ||
|  | Below is a basic example of an template literal: | ||
|  | 
 | ||
|  | ```javascript | ||
|  | // ES5 syntax | ||
|  | var es5String = "ES5 String" | ||
|  | var es5StringWithVariable = "ES5 String with a " + variable + "..." | ||
|  | 
 | ||
|  | // ES6 template literal | ||
|  | const tempLit = `Simple string` | ||
|  | 
 | ||
|  | // ES6 template literal with variable | ||
|  | let tempLitWithVariables = `Simple string with a ${variable}...` | ||
|  | 
 | ||
|  | // ES6 multiple line template literal  | ||
|  | const multiLineString = ` | ||
|  |   Multiple  | ||
|  |   Lines  | ||
|  |   Allowed | ||
|  | ` | ||
|  | ``` | ||
|  | 
 | ||
|  | 
 |