In this assignment, you are going to create a JavaScript file containing 10 functions. Each function represents one step, and 10 marks are assigned to each step (function). The functions you create...

1 answer below »
In this assignment, you are going to create a JavaScript file containing 10 functions. Each function represents one step, and 10 marks are assigned to each step (function). The functions you create might be very simpler to a built-in JavaScript function. Each function needs to be considered as an individual problem, and you just focus on that one problem when you code the function. What to implement? • Create only one JavaScript file• All the functions you implement must be placed in that JavaScript file, and you are not allowed to use any other external file or library. •
Answered Same DayMar 19, 2021

Answer To: In this assignment, you are going to create a JavaScript file containing 10 functions. Each function...

Suraj Prakash answered on Mar 25 2021
146 Votes
function stringLength(s)
{
    var len = 0;
    while(s[len]!== undefined)
        {
            len++;
        }
    retur
n len;
}
function toLowerCaseString(s)
{
    var i = 0;
    var lowerCase = "";
    while(s[i]!== undefined)
    {
        if(s.charCodeAt(i)>=65 && s.charCodeAt(i)<=90)
            {
                lowerCase += String.fromCharCode(s.charCodeAt(i) + 32);
            }
        else    
            lowerCase += s[i];
        i++;
    }
    return lowerCase;
}
function reverseString(s)
{
    var i = stringLength(s) - 1;
    var str = "";
    while(i!==-1)
    {
        str += s[i];
        i--
    }
    return str;
}
function sumOfArray(arr)
{
    var i = 0, sum = 0;
    while(arr[i])
    {
        if(isNaN(arr[i]))
        {
            i++;
            continue;
        }
        else
        {
            sum += arr[i];
            i++;
        }
    }
    return sum;
}
function removeCharFromString(str, ch)
{
    var i = 0;
    var output = "";
    var len = stringLength(str);
    while(str[i]!== undefined)
    {
        if(str[i] == ch)
        {
            i++;
            continue;
        }
        else
        {
            output += str[i];
            i++;
        }
    }
    return...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here