+ 4
I learnt javascript! But can anyone of you tell me how to code in js to male it upload on codechef!
I learnt javascript! But can anyone of you tell me how to code in js to male it upload on codechef! I saw many correct submitted programs but I can't understand the uses of import keyword in the program!
1 Antwort
+ 4
import keyword was introduced in JavaScript version, ES6 to support native modules. What it means is that you can export contents from one JS file and use the import keyword to make it available in another JS file. i.e
// myFunc.js
export default function(x) {
return x * x;
}
// main.js
import myFunc from 'myFunc';
myFunc(2);
// => 4
So from the above a function was defined in myFunc.js file and made available in main.js file. Later invoked with a parameter and the result as seen above. Happy coding!