Skip to content

marameref/GMC_Js_endabit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GMC Endabit Javascript Assignment:

# JavaScript Coding Assignments

This repository contains solutions to various JavaScript coding challenges designed to practice fundamental programming concepts such as functions, arrays, dates, and logic implementation. Each problem includes the problem statement, a solution function, and example usage.

---

## Assignments Included

### 1. Return the Sum of Two Numbers
Create a function that takes two numbers as arguments and returns their sum.

Example:
```js
addition(3, 2) ➞ 5

2. Area of a Triangle

Write a function that takes the base and height of a triangle and returns its area.

Example:

triArea(3, 2)  3

3. Convert Minutes into Seconds

Write a function that takes an integer representing minutes and converts it to seconds.

Example:

convert(5)  300

4. A Redundant Function

Write a function redundant that takes a string and returns a function that returns that string.

Example:

const f1 = redundant("apple");
f1()  "apple"

5. Count True Values in an Array

Create a function that returns the number of true values in a boolean array.

Example:

countTrue([true, false, true])  2

6. Derivative of a Function

Write a function to compute the derivative of $f(x) = x^b$ evaluated at $x = m$.

Example:

derivative(3, -2)  12

7. Seven Boom!

Create a function that takes an array of numbers and returns "Boom!" if any number contains the digit 7; otherwise, returns "there is no 7 in the array".

Example:

sevenBoom([1, 2, 3, 7])  "Boom!"

8. Length of a Nested Array

Write a function that returns the total number of non-nested elements in a nested array.

Example:

getLength([1, [2, 3]])  3

9. How Many Days Between Two Dates

Create a function that takes two dates and returns the number of days between them.

Example:

getDays(new Date("June 14, 2019"), new Date("June 20, 2019"))  6

How to Run

  1. Ensure you have Node.js installed.

  2. Run the script files using the command:

    node <filename>.js
  3. Check console output for results.


Author

Created by Engr. Amarachi Crystal Omereife


About

My submission for endabit assignments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors