Skip to content

Apurva Shukla Module4#70

Open
apurvaone wants to merge 18 commits intohotwax:mainfrom
apurvaone:ApurvaShukla-Module4
Open

Apurva Shukla Module4#70
apurvaone wants to merge 18 commits intohotwax:mainfrom
apurvaone:ApurvaShukla-Module4

Conversation

@apurvaone
Copy link

@apurvaone apurvaone commented Apr 15, 2023

Completed Module 4:

  1. Learned JavaScript concepts.
  2. Learned functional programming concepts such as:
    Higher-order functions
    Pure functions
    Immutability
    Recursion
    Function composition
    Currying
  3. Utilized Cheerio and Axios libraries for scraping and making HTTP requests respectively
  4. Solved Module 2 problems- (WordCount, EmployeeManagement, Multithreading, Serialization) in JavaScript and functional programming
  5. Added unit tests to the codebase.

switch (choice.trim()) {
case '1':
rl.question('Enter name:', (name) => {
rl.question('Enter email:', (email) => {
Copy link

@Nidhipal09 Nidhipal09 Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this validation- if the entered email already exists because no two employees can have the same email. Also because you have used email as the key in the delete employee function.

function readUrlAndWords(){

let urlsSet = new Set() ;
let wordsSet = new Set();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 'const' here. Variables that are not going to be changed shouldn't be declared with 'var' or 'let'.

const response = await axios.get(url);
const $ = cheerio.load(response.data);
const textContent = $('body').text().replace(/\r/g, '').trim();
return textContent;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a declarative rather than an imperative approach. The code must follow functional programming concepts.

case '5':
console.log('Exiting program.');
rl.close();
break;
Copy link

@Nidhipal09 Nidhipal09 Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 'process.exit(0)' in place of 'break' to exit the program here.

}

// Create a readline interface to read user input
const rl = readline.createInterface({
Copy link

@Nidhipal09 Nidhipal09 Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use descriptive variable names. Need to correct this in many places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants