Skip to content

Commit 4b04bd6

Browse files
authored
Create a function using Function constructor
How to create a function using constructor
1 parent 48afc0d commit 4b04bd6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
|33 | [replaceAll](#replaceAll)|
4040
|34 | [Required Function Params](#Required-Function-Params)|
4141
|35 | [Get input value as a number](#Get-input-value-as-a-number)|
42+
|36 | [Creating a function using Function constructor](#Create-Function-Using-Constructor)|
43+
4244

4345

4446

@@ -753,4 +755,16 @@ function checkMyType(event){
753755
754756
}
755757
758+
```
759+
760+
**[⬆ Back to Top](#table-of-contents)**
761+
### Create a function using Function constructor
762+
```javascript
763+
function bar() {
764+
return new Function('return "x"');
765+
};
766+
var x = bar();
767+
x();//returns x
768+
769+
756770
```

0 commit comments

Comments
 (0)