2.8. ExercisesΒΆ

  1. Translate the following into Javascript:

    def sumlist(l):
        total = 0
        for num in l:
            total = total + num
    
        return total
    
  1. Write a function that accepts an array of numbers and returns the largest number in the array.

  1. Write a function that constructs an Array containing the first 10 prime numbers

  1. Write a function that removes all occurrences of a given letter from a string. The first parameter should be the letter and the second parameter the string.

  1. Write a function that takes a string as a parameter and returns the reversed string

  1. Write a function that takes an integer as an argument and returns the number of digits in the integer.

  1. Write a function that recognizes palindromes. The function takes a string as a parameter and returns true if the string is a palindrome and false if it is not

You have attempted of activities on this page