Functionbeginnerconst square = new Function('n', 'return n * n')
square(5) // β 25Use new Function() when you need to generate functions dynamically from strings.
You can pass parameter names and a body string to new Function() to create a function dynamically at runtime.
Challenge: Create an add function using new Function('a', 'b', 'return a + b') and confirm it returns 5 for add(2, 3).