Google News
logo
CoffeeScript - Interview Questions
Explain Dynamic import in CoffeeScript.
Dynamic import is also supported in CoffeeScript, with mandatory parentheses:
# Your browser must support dynamic import to run this example.
​
do ->
  { run } = await import('./browser-compiler-modern/coffeescript.js')
  run '''
    if 5 < new Date().getHours() < 9
      alert 'Time to make the coffee!'
    else
      alert 'Time to get some work done.'
  '''
// Your browser must support dynamic import to run this example.
(async function() {
  var run;
  ({run} = (await import('./browser-compiler-modern/coffeescript.js')));
  return run(`if 5 < new Date().getHours() < 9
  alert 'Time to make the coffee!'
else
  alert 'Time to get some work done.'`);
})();
​
Advertisement