Following are the key points described later in this article:
var drawTraingle = function() {
console.log("Traingle drawn");
}
var drawCircle = function() {
console.log("Circle drawn");
}
Above code could be saved as draw.js. The file draw.js could be used to represent a module representing functions to draw different shapes. As per this page, module.exports is the object that’s actually returned as the result of a require call.
module.exports = {
drawTraingle: function() {
console.log("Traingle drawn");
},
drawCircle: function() {
console.log("Circle drawn");
}
};
The above code could also be written as following:
var drawTraingle = function() {
console.log("Traingle drawn");
};
var drawCircle = function() {
console.log("Circle drawn");
};
exports.drawTraingle = drawTraingle;
exports.drawCircle = drawCircle;
Following code represents how the above function can be used in other file, say, main.js
var d = require("./draw.js");
d.drawTraingle();
d.drawCircle();
Pay attention to usage of “require” function.
node main.js
It would print following:
Traingle drawn
Circle drawn
Large language models (LLMs) have fundamentally transformed our digital landscape, powering everything from chatbots and…
As Large Language Models (LLMs) evolve into autonomous agents, understanding agentic workflow design patterns has…
In today's data-driven business landscape, organizations are constantly seeking ways to harness the power of…
In this blog, you would get to know the essential mathematical topics you need to…
This blog represents a list of questions you can ask when thinking like a product…
AI agents are autonomous systems combining three core components: a reasoning engine (powered by LLM),…