Array

- null_string_to_array: This function will convert a space-separated string of values to an array. It takes one argument which is a string to be converted to an array.

JS |
const myString = "Hello World From Null";

const myArr = null_string_to_array(myString);

console.log(myArr); // ["Hello", "World", "From", "Null"]

- null_count_duplicates_in_array_to_object: This function will count the number of occurrences of each item in an array and return them as an object. It takes one argument which is an array.

JS |
const myArray = ["male", "female", "male", "male"];

const myObject = null_count_duplicates_in_array_to_object(myArray);

console.log(myObject); // {female:1, male:3}

- null_remove_duplicates_from_array: This function will removes duplicate items from an array and returns a new array with only unique items. It takes one argument which is the array to remove duplicate from.

JS |
const myArray = ["male", "female", "male", "male"];

const myUniqueArray = null_remove_duplicates_from_array(myArray);

console.log(myUniqueArray); // ["male", "female"];

- null_remove_value_from_array: This function will remove a specific value from an array and return a new array without that value. It takes two arguments the first one is the array to remove value from, and the second is the value to be removed.

JS |
const myArray = ["Usa", "Canada", "Usa", "UK"];

const newArray = null_remove_value_from_array(myArray, "Canada");

console.log(newArray); // ["Usa", "Usa", "UK"];

- null_remove_values_from_array: This function will remove specific values from an array. It takes two arguments the first one is the current array that you want to remove values from and the second value is an array of items you want to delete.

JS |
const nullArray = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];

const nullNewArray = null_remove_values_from_array(nullArray, "2","4","6");

console.log(nullNewArray); //  ['1', '3', '5', '7', '8', '9', '10']

- null_count_most_frequent: This function will count the most frequently occurring element in an array and return an object with its value and frequency. It takes one argument which is the array to count.

JS |
const nullArray = ["2","2","2","1","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"];

const nullNewArray = null_count_most_frequent(nullArray);

console.log(nullNewArray); // {value: '2', freq: 3}

- null_extract_values_from_array_to_new_array: This function will extract specific values from an array then apply them to new array. It takes two arguments, the first one is the array you want to extract value from, the second is array of values that you want to extract.

JS |
const nullArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

const nullNewArray = null_extract_values_from_array_to_new_array(nullArray, [2, 4, 6]);

console.log(nullNewArray); // [2, 4, 6]