Import all

Report a typo

The following module has several exports as shown in the code snippet below.

// person.mjs
export const name = 'Jack';

export const personalData = {
	phone: '555 555 55',
	address: 'Washington ave., 55',
	origin: 'USA',
};

export function habitsInfo(name) {
	const habits = ['sport', 'healthy food', 'early bird'];
	let habitsString = '';
	habits.forEach((h,i,a) => i+1 < a.length ? habitsString+=`${h}, ` : habitsString+=h);
	return `${name} has these habits: ${habitsString}`;
};

Write an import statement to import all of them.

Use a relative path for person.mjs in this case. Also, if you decide to import each object of the module by the name, use the same order as in the module. Use spaces inside the brackets { name1, name2 }
Enter a short text
___

Create a free account to access the full topic