The document outlines a series of JavaScript exercises designed to enhance programming skills. It includes tasks such as creating functions for basic arithmetic operations, checking even or odd numbers, and manipulating objects. Additionally, it covers topics like calculating areas, checking grades, and swapping variable values.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
1 views1 page
Javascript Exercise 1
The document outlines a series of JavaScript exercises designed to enhance programming skills. It includes tasks such as creating functions for basic arithmetic operations, checking even or odd numbers, and manipulating objects. Additionally, it covers topics like calculating areas, checking grades, and swapping variable values.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Javascript exercise
1.Write a function calculate(a, b, operator) that performs addition, subtraction,
multiplication, or division based on the operator provided. 2.Write a function isEven(number) that returns "Even" if the number is even and "Odd" if the number is odd. 3.Create a student object with properties: name, age, grade. Then print a sentence using those values. 4.Write a function that takes two numbers and returns the greater one, or a message if they're equal. 5.Write a function checkType(value) that returns the type of the input using typeof. 6.Write a function that calculates the area of a circle given the radius. Use π = 3.14. 7.Create a function createProfile(name, age) that returns an object with name, age, and a greeting method that says "Hello, my name is X". 8.Given two variables a and b, write a function to swap their values. 9.Write a function checkGrade(score) that returns: