Skip to content

Musiki8213/JavaScript-Math-Object-Mastery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

JavaScript Math Object Mastery

Part 1: Theory Questions

What is the Math object in JavaScript?

The Math object in JavaScript is a built-in object that provides mathematical constants and functions, such as rounding, trigonometric calculations, exponentiation, and random number generation. It is not a constructor and is used directly.

Is it a constructor (i.e., can you create an instance with new Math())?

→ No, Math is not a constructor. You cannot use new Math(). Instead, you use it as a static object, like Math.round(5.5).

Explain the difference between:

  • Math.round() → Rounds a number to the nearest integer. If the decimal is 0.5 or higher, it rounds up; otherwise, it rounds down.
  • Math.ceil() → Rounds a number up to the next largest integer, regardless of the decimal.
  • Math.floor() → Rounds a number down to the next smallest integer, regardless of the decimal.

How does Math.random() work?

Math.random() generates a pseudo-random floating-point number between 0 (inclusive) and 1 (exclusive), such as 0.472 or 0.999.

What is the range of values it can produce?

→ It produces values in the range:
0 ≤ value < 1


Part 2: Module 4 KT 0102 – Mathematical Thinking

KT 0102 Mathematical Thinking Steps:

1.Break the task down into components

2.Identify assumptions

3.Look for a pattern or connection

4.Create a plan (timeline & logical order)

5.Stay on track

6.Review & reflect

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published