반응형
/**
 * const plus = (a, b) => a + b;
 * const minus = (a, b) => a - b;
 * const divide = (a, b) => a / b;
 *
 * -----------------------------------------
 * [Export Whole Thing] export default {plus, minus, divide};
 * [just one] export default plus;
 *
 * --------------- how to import ----------------------
 * [Export Whole Thing]import math_plus from "./math.mjs";
 * [just one] import math_plus from "./math.mjs";
 *
 * [Export Whole Thing] console.log(math_plus.plus(5, 4));
 * [just one] console.log(math_plus(5, 4));
 */


/**
 * export const plus = (a, b) => a + b;
 * export const minus = (a, b) => a - b;
 * export const divide = (a, b) => a / b;
 *
 * -----------------------------------------
 * [Same As Above] export {plus, minus, divide}
 * [just one] export {plus}
 *
 * --------------- how to import ----------------------
 * import { plus, minus, divide } from "./math.mjs"; [just one]
 * import { plus } from "./math.mjs"; [just one]
 *
 * console.log(plus(5, 4));
 */
반응형