NPM & Third Party Coding Practice 2

 

Get Date After x Days

Given an

index.js
file parallel to
README.md
file.

Write a JS function that accepts

days
as an argument and return the date after given number of
days
from 22nd Aug 2020 using the
date-fns
package.

Export the function using the default export syntax.

Date Format

DD-MM-YYYY

Use Common JS module syntax

Greeting Message

Create a new file

index.js
in the message directory.

Write a JS program to export the string

Hello Rahul! Have a Great Day
using the message from
greeting/index.js
.

Export the template string using the default export syntax.

Use Common JS module syntax

First Names of the People

Create a file

index.js
in the names directory.

Write a JS function in

index.js
with function name
getPeopleInCity
that accepts people names list and returns an array of containing the first names of the people.

Export the function using the default export syntax.

Folder Structure
country
- state
- city
- index.js // contains the people names list
utilities
- utils
- index.js // contains a function that returns the first names of the people
names
- index.js // create the file and write your code here
 

Use the given modules.

Use Common JS module syntax

Calculate Ratio and Factorial

Create a file

index.js
in the ratioFactorial directory.

Write a JS function in

index.js
that accepts 3 numbers as arguments and return the ratio of the first two numbers and factorial of the third number in an object with keys as
ratio
and
factorial
.

Export the function using default export syntax.

Folder Structure
utilities
- factorial
- index.js // contains a function that returns the factorial of the given number
- ratio
- index.js // contains a function that returns the ratio of 2 given numbers
- ratioFactorial
- index.js // create the file and write your code here
 

Use the functions provided in the ratio and factorial directories.

Use Common JS module syntax

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

Contact Form