sridhar-math-module
- In this Module Provide some of the Math Operation's. We can do Some type of Math operations with the help of this module
On Ubuntu/Debian:
sudo apt install npm nodejs
On Windows: npm install -g npm
Use Node to install from NPM Package Module
$ npm install <module name> --save
var sridhar-math-module = require('sridhar-math-module');
var addtiton = sridhar-math-module.add(value1,value2);
console.log(addtiton);
var subtraction = sridhar-math-module.add(10,10);
console.log(addtiton);
20
var subtraction = sridhar-math-module.sub(value1,value2);
console.log(subtraction);
var subtraction = sridhar-math-module.sub(100,10);
console.log(subtraction);
90
var multiplication = sridhar-math-module.mul(value1,value2);
console.log(multiplication);
var multiplication = sridhar-math-module.mul(10,10);
console.log(multiplication);
100
var division = sridhar-math-module.div(value1,value2);
console.log(division);
var division = sridhar-math-module.div(100,10);
console.log(division);
10
var factorial = sridhar-math-module.fact(value);
console.log(factorial);
var factorial = sridhar-math-module.fact(5);
console.log(factorial);
120
var pow = sridhar-math-module.pow(value1,values2);
console.log(pow);
var pow = sridhar-math-module.pow(2,3);
console.log(pow);
8
var equals = sridhar-math-module.equals(value1,values2);
console.log(equals);
var equals = sridhar-math-module.equals('Hello world','Hello world');
console.log(equals);
true
var greater = sridhar-math-module.grt(value1,value2);
console.log(greater);
var greater = sridhar-math-module.grt(100,102);
console.log(greater);
102
var lesser = sridhar-math-module.lser(value1,value2);
console.log(lesser);
var lesser = sridhar-math-module.lser(100,120);
console.log(lesser);
100
var grt_equal = sridhar-math-module.grt_equl(value1,value2);
console.log(grt_equal);
var grt_equal = sridhar-math-module.grt_equl(100,102);
console.log(grt_equal);
true
var lessequal = sridhar-math-module.lessequl(value1,value2);
console.log(lessequl);
var lessequl = sridhar-math-module.lessequl(100,102);
console.log(lessequl);
true
var sort = sridhar-math-module.sort(array);
console.log(sort);
var sort = sridhar-math-module.sort([9,6,7,5,3,1,3,2,4]);
console.log(sort);
1,2,3,4,5,6,7,8,9
var rev_sort = sridhar-math-module.sort_reverse(array);
console.log(rev_sort);
var rev_sort = sridhar-math-module.sort_reverse([9,6,7,5,3,1,3,2,4]);
console.log(rev_sort);
9,8,7,6,5,4,3,2,1
var reverse_each_word = sridhar-math-module.reverse_each_word(string, separator);
console.log(reverse_each_word);
<!-- var reverse_each_word = sridhar-math-module.reverse_each_word("sridhar", "separator); TODO:Find the Seperate meaning -->
console.log(reverse_each_word);
var isInt = sridhar-math-module.isInt(Number);
console.log(isInt);
var isInt = sridhar-math-module.isInt(10);
console.log(isInt);
true
var duplicate_arr = sridhar-math-module.duplicate_arr(array);
console.log(duplicate_arr);
var duplicate_arr = sridhar-math-module.duplicate_arr([1,2,3,4,5,6,7,7]);
console.log(duplicate_arr);
[1,2,3,4,5,6,7],[1,2,3,4,5,6,7] TODO: check the Given output
var duplicate_arr = sridhar-math-module.duplicate_arr(array);
console.log(duplicate_arr);
var duplicate_arr = sridhar-math-module.duplicate_arr([1,2,3,4,5,6,7,7]);
console.log(duplicate_arr);
[1,2,3,4,5,6,7]
var anagrams = sridhar-math-module.anagrams(string1,stirng2); TODO: Check the input values Input1 and Input2
console.log(anagrams);
var anagrams = sridhar-math-module.anagrams("example","example");
console.log(anagrams);
[1,2,3,4,5,6,7] TODO: Check the output of the Given string's
var Sum_array = sridhar-math-module.Sum_array(Array);
console.log(Sum_array);
var Sum_array = sridhar-math-module.Sum_array([1,2,3,4,5]);
console.log(Sum_array);
15
var divisible_by_value = sridhar-math-module.divisible_by_value(Dividend,Divisor);
console.log(divisible_by_value);
var divisible_by_value = sridhar-math-module.divisible_by_value(10,3);
console.log(divisible_by_value);
false
var gcd_two_numbers = sridhar-math-module.gcd_two_numbers(x,y);
console.log(gcd_two_numbers);
var gcd_two_numbers = sridhar-math-module.gcd_two_numbers(10,10);
console.log(gcd_two_numbers);
false TODO: check the GCD of the two values
var abs = sridhar-math-module.abs(x);
console.log(abs);
var abs = sridhar-math-module.abs(-10);
console.log(abs);
10 TODO: check the Absolute value of the output
var findDuplicates = sridhar-math-module.findDuplicates(x);
console.log(findDuplicates);
var findDuplicates = sridhar-math-module.findDuplicates([1,2,1,2,3,4,5,3,2,3]);
console.log(findDuplicates);
1,2,3
var get_positive_or_negative = sridhar-math-module.get_positive_or_negative(x);
console.log(get_positive_or_negative);
var get_positive_or_negative = sridhar-math-module.get_positive_or_negative(-1);
console.log(get_positive_or_negative);
-1 is negative number
var greater_element_arr = sridhar-math-module.greater_element_arr(array);
console.log(greater_element_arr);
var greater_element_arr = sridhar-math-module.greater_element_arr([1,2,3,56,72,01,23,3435]);
console.log(greater_element_arr);
3435
var lower_element_arr = sridhar-math-module.lower_element_arr(array);
console.log(lower_element_arr);
var lower_element_arr = sridhar-math-module.lower_element_arr([1,2,3,56,72,01,23,3435]);
console.log(lower_element_arr);
1
var array_reverse = sridhar-math-module.array_reverse(array);
console.log(array_reverse);
var array_reverse = sridhar-math-module.array_reverse([1,2,3,4,5,6]);
console.log(array_reverse);
6,5,4,3,2,1
var remove_by_length = sridhar-math-module.remove_by_length(array,len);
console.log(remove_by_length);
var remove_by_length = sridhar-math-module.remove_by_length([1,2,3,4,5,6],3);
console.log(remove_by_length);
1,2,3
var remove_beginning_element_array = sridhar-math-module.remove_last_element_array(array);
console.log(remove_last_element_array);
var remove_last_element_array = sridhar-math-module.remove_last_element_array([1,2,3,4,5,6]);
console.log(remove_last_element_array);
1,2,3,4,5
var remove_beginning_element_array = sridhar-math-module.remove_beginning_element_array(array);
console.log(remove_beginning_element_array);
var remove_beginning_element_array = sridhar-math-module.remove_beginning_element_array([1,2,3,4,5,6]);
console.log(remove_beginning_element_array);
2,3,4,5,6
var remove_specific_index__element_array = sridhar-math-module.remove_specific_index__element_array(array,index);
console.log(remove_specific_index__element_array);
var remove_specific_index__element_array = sridhar-math-module.remove_specific_index__element_array([1,2,3,4,5,6],6);
console.log(remove_specific_index__element_array);
2,3,4,5
var perfect_number = sridhar-math-module.perfect_number(number);
console.log(perfect_number);
var perfect_number = sridhar-math-module.perfect_number(TODO: Check the Input Element);
console.log(perfect_number);
2,3,4,5, TODO:
var reverseString = sridhar-math-module.reverseString(string);
console.log(reverseString);
var reverseString = sridhar-math-module.reverseString("Hello World");
console.log(reverseString);
dlroW olleH
var sort_array_element = sridhar-math-module.sort_array_element(array);
console.log(sort_array_element);
var sort_array_element = sridhar-math-module.sort_array_element([1,6,7,3,98,454]);
console.log(sort_array_element);
1,3,6,7,98,454