0% 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.

Uploaded by

mugisha zila
Copyright
© © All Rights Reserved
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% 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.

Uploaded by

mugisha zila
Copyright
© © All Rights Reserved
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:

●​ "A" if score ≥ 90​

●​ "B" if 80–89​

●​ "C" if 70–79​

●​ "D" if 60–69​

●​ "F" if below 60

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy