240624
This commit is contained in:
		
							
								
								
									
										10
									
								
								6.5NewFunctionGrammar/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								6.5NewFunctionGrammar/index.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
|     <title>Title</title> | ||||
| </head> | ||||
| <body> | ||||
| <script src="t.js"></script> | ||||
| </body> | ||||
| </html> | ||||
							
								
								
									
										7
									
								
								6.5NewFunctionGrammar/t.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								6.5NewFunctionGrammar/t.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| let func = new Function('a', 'b', 'return a+b'); | ||||
|  | ||||
| console.log(func(1,2)) | ||||
|  | ||||
| let x = 10; | ||||
| func = new Function('return x;'); | ||||
| console.log(func()); // Error: x is not defined | ||||
		Reference in New Issue
	
	Block a user