- Using require we execute a .js file into our file
- In below example add.js and first.js are the two .js file
- we can execute both the .js file in a single execution using require, example below
add.js
function add(a,b){ return a+b; } console.log(add(10,20));
first.js
require('./add.js'); function greet(name){ console.log("Hello there "+name) } greet("Tyson");