Welcome to example-sum-hminhthu, a simple JavaScript library that provides utility functions to work with objects, arrays, and perform basic arithmetic operations.
npm install example-sum-hminhthu
First, import the required functions from the library:
const { areObjects, areArrays, sum } = require('my-library');
You can use the areObjects function to check if two items are objects:
const obj1 = { a: 1 };
const obj2 = { b: 2 };
console.log(areObjects(obj1, obj2)); // Output: true
You can use the areArrays function to check if two items are arrays:
const arr1 = [1, 2, 3];
const arr2 = [4, 5, 6];
console.log(areArrays(arr1, arr2)); // Output: true
The sum function allows you to sum three numbers:
const result = sum(1, 2, 3);
console.log(result); // Output: 6
Checks if obj1 and obj2 are both objects.
- obj1 (any): The first item to check.
- obj2 (any): The second item to check.
- Returns:
trueif both items are objects, otherwisefalse.
Checks if arr1 and arr2 are both arrays.
- arr1 (any): The first item to check.
- arr2 (any): The second item to check.
- Returns:
trueif both items are arrays, otherwisefalse.
Sums three numbers a, b, and c.
- a (number): The first number.
- b (number): The second number.
- c (number): The third number.
- Returns: The sum of the three numbers.
This project is licensed under the MIT License.