JavaScript Coding Tasks Student ID - 11287773 This repository contains three JavaScript coding tasks.
processArray:
This function takes an array of numbers as input and applies a transformation to each element. If the number is even, it squares the number. If the number is odd, it multiplies the number by 3. The transformed elements are returned in a new array.
formatArrayStrings:
This function takes two arrays as input: an array of strings and an array of numbers. The function ensures that the two arrays are of the same length. If not, it throws an error. For each corresponding pair of string and number, the function formats the string as follows: If the number is even, the string is converted to uppercase. If the number is odd, the string is converted to lowercase. The formatted strings are returned in a new array.
createUserProfiles:
This function takes two arrays as input: an array of original names and an array of modified names. The function ensures that the two arrays are of the same length. If not, it throws an error. The function creates an array of user profile objects, where each object has three properties: originalName, modifiedName, and id. The id property is generated based on the index of the corresponding elements in the input arrays (starting from 1). The function returns the array of user profile objects.