javascript module

1:---{

  "name": "testcheckbox",
  "version": "1.0.0",
  "description": "",
  "main": "A.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

2:--

function getPower() {
    return "good morning";
}
function capitalize(word) {
    return word[0].toUpperCase() + word.slice(1);
}
export { getPower,capitalize };

3:-- 

import { getPower,capitalize } from "./A.js";

console.log(getPower());
console.log(capitalize("rajkumar"));

Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation