LoginSignup
1
0

More than 1 year has passed since last update.

Node.js 複数インポート、エクスポートする方法

Posted at

Node.jsの学習の備忘録と振り返りの記事です。
何かの参考になれば幸いです。
付け足しや訂正などある場合ご教授いただけると
大変嬉しく思います!!

複数インポート、エクスポートする方法


const name = "yuka";
const add = function (a,b){
  return a + b
}

module.export = {
  //定義名:値,
  name:name,
  add:add, //最後のカンマは無くてもあってもどっちでもいい
}

//===別ファイル===
const {name,add} = require("インポートしたいファイル名")
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0