Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

--Write JavaScript code to print the email address(es) exported from the following module. You need to pass a text string containing email addresses. As example,

--Write JavaScript code to print the email address(es) exported from the following module. You need to pass a text string containing email addresses. As example, boleh firmansyah1404@ minta kirim ke db.maulana@g terimakasih bu Cindy Hartanto. Note that the module file and the file using the module are two different files. No point was assigned if the supplied code was not used as a module.

// module "findemail.js"

export function findEmail(text) {

return text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi);

}

the code I have :

import { findEmail } from "./findemail.js"; import fs from "fs";

// Read the contents of the text file into a string variable. const text = fs.readFileSync("sample.txt", "utf8");

// Find all email addresses in the text and print them to the console const emails = findEmail(text); console.log(emails);

the error msg:

Error: Failed to resolve package './findemail.js'

can I get help with error code and fill all the blanks in the code . and screen shot for result use any two fake mail

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

Ability to work comfortably in a team environment

Answered: 1 week ago

Question

Exposure to SQL desirable but not required

Answered: 1 week ago