how to import npm packages in node.js?

JavaScript
//in cmd prompt: 
//npm i <package-name>

//defining package in code: 
const package = require("package-name")
Source

Also in JavaScript: