Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

355
Vistas
How to import/export in JavaScript and TypeScript?

I've seen 2 ways for importing modules in JavaScript and TypeScript respectively and I'm confused.

(1) Method 1: Import

const * = require('./runtime');

(1) Method 1: Export

exports.login = function() {};

(2) Method 2: Import

import * from './runtime';

(2) Method 2: Export

export function login() {};

May I know which one to use with in JavaScript and which one with TypeScript?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Both are correct however the first 2 ones are older and used in jquery or lower versions of javascript and One of the major differences between require() and import() is that require() can be called from anywhere inside the program whereas import() cannot be called conditionally, it always runs at the beginning of the file. you can also refer here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda