Javascript Basic Coding Introduction Practice assignments

  1. Basic Functions
    1. Write a function which can return the sum of two numbers.
                                  function add(a,b){
                                      …………………
                                  }
                                  var sum = add(45,67);
                                  console.log(sum);
                                  //Expected output: 112
                              
    2. Write a function which can return the greatest of the three numbers passed in arguments.
                                  function compare(a,b,c){
                                      …………………
                                  }
                                  var greatest = compare(45,67,23);
                                  console.log(greatest);//67
                              
    3. Write a function which can print the given arguments in ascending order.
                                  
                                  function sortNums(a,b,c){
                                  …………………
                                  }
                                  var ascending = sortNums(45,7,68);
                                  console.log(ascending);//
                              
    4. Write a function which can return the factorial of a number.
                                  
                                  function fact(a){
                                  …………………
                                  }
                                  var factorial = fact(4);
                                  console.log(factorial);
                              
    5. Write a function which can to return the reverse of a given number.
                                  function rev(a){
                                  …………………
                                  }
                                  var reverse = rev(4);
                                  console.log(reverse);
                              
    6. Write a function which can check a given number is prime number or not
    7. Write a function which can check a given number is palindrome or not
    8. Write a function to return the number of digits in the given number
    9. Write a function that prints all even numbers between 1 and 20.
    10. Write a function which can add two numbers
    11. Write a function which can display the greatest of the three numbers passed in arguments.
    12. Write a function which can display the given arguments in ascending order
    13. Write a function which can display the factorial of a number
    14. Write a function which can to display the reverse of a given number
    15. Write a function which can check a given number is palindrome or not
    16. Write a function which can check a given number is prime number or not
    17. Write a function which can check a given number is armstrong number or not
    18. Write a function which can return the factorial of a number to another variable
    19. Write a function to display the number of digits in the given number
    20. Write a function that returns an array of all even numbers between 1 and 20.
    21. Cube of any number using the function.
    22. Find diameter, circumference and area of a circle using functions.
    23. Maximum and minimum between two numbers using functions.
    24. Check whether a number is even or odd using functions.
    25. Check whether a number is prime, Armstrong or perfect number using functions.
    26. Find all prime numbers between the given interval using functions.
    27. Print all strong numbers between the given interval using functions.
    28. Armstrong numbers between the given interval using functions.
    29. Print all perfect numbers between the given interval using functions.
    30. Find the power of any number using recursion.
    31. Print all natural numbers between 1 to n using recursion.
    32. Print all even or odd numbers in a given range using recursion.
    33. Sum of all natural numbers between 1 to n using recursion.
    34. Find the sum of all even or odd numbers in a given range using recursion.
    35. Find reverse of any number using recursion.
    36. Check whether a number is a palindrome or not using recursion.
    37. Find the sum of digits of a given number using recursion.
    38. Find factorial of any number using recursion.
    39. Generate nth Fibonacci term using recursion.
    40. Find gcd (HCF) of two numbers using recursion.
    41. Find lcm of two numbers using recursion.
    42. Display all array elements using recursion.
    43. Find the sum of elements of the array using recursion.
    44. Find maximum and minimum elements in an array using recursion.
    45. implement all the Array Assignments using Array Methods
    46. implement all the Object Assignments and Array of Object Assignments
    47. impletement string assingments using string methods