“Modul JavaScript” Kode Jawaban

Modul Impor JS HTML

<script type="module" src="main.js"></script>
Ugliest Unicorn

Modul JavaScript

export const name = "Jesse";
export const age = 40;
naly moslih

Modul JavaScript

// importing greetPerson from greet.js file
import { greetPerson } from './greet.js';

// using greetPerson() defined in greet.js
let displayName = greetPerson('Jack');

console.log(displayName); // Hello Jack
SAMER SAEID

Modul JavaScript

import { greet } from '/.greet.js';
SAMER SAEID

Modul JavaScript

// exporting a function
export function greetPerson(name) {
    return `Hello ${name}`;
}
SAMER SAEID

Modul JavaScript

export function greetPerson(name) {
    ... 
}
SAMER SAEID

Jawaban yang mirip dengan “Modul JavaScript”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya