MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Math Object Basics0%
Study Materials
JavaScript for BeginnersProgress 0%
1.1What is JavaScript?1.2How JavaScript Works in Browser1.3Setting up Environment: VSCode, Live Server
9.1Working with Date Object9.2Math Object Basics9.3Random Numbers Example
HomeTutorialsJavaScript for BeginnersMath Object Basics
Random Numbers Example

Math Object Basics

Beginner12 min read•Updated: 2026-09-15•By Er. Sumit Kumar (MSK Institute)
Study Materials

Unlike Date or Array, the Math object in JavaScript is not a constructor (you never call new Math()). It is a built-in static object containing mathematical constants and functions for rounding, geometric calculations, and numerical transformations.


1. Built-in Mathematical Constants

1console.log(Math.PI); // 3.141592653589793 (Ratio of circumference to diameter)
2console.log(Math.E); // 2.718281828459045 (Euler's constant)
3console.log(Math.SQRT2); // 1.4142135623730951 (Square root of 2)

2. Rounding Functions (The Essential Four)

MethodBehaviorExampleResult
Math.round(x)Standard rounding (Rounds to nearest integer; 0.5 rounds up)Math.round(4.5)5
Math.floor(x)Always rounds DOWN toward negative infinityMath.floor(4.9)4
Math.ceil(x)Always rounds UP toward positive infinityMath.ceil(4.1)5
Math.trunc(x)Simply strips the decimal fraction (truncates)Math.trunc(-4.9)-4
1// Comparing negative rounding:
2console.log(Math.floor(-3.2)); // -4 (Down toward negative infinity)
3console.log(Math.trunc(-3.2)); // -3 (Just removes .2)

3. Min, Max, and Absolute Values

A. Math.abs(x): Absolute (Non-negative) Value

1console.log(Math.abs(-25)); // 25
2console.log(Math.abs(25)); // 25

B. Math.min() and Math.max():

Finds the lowest or highest value from a list of arguments:

1console.log(Math.min(10, 4, 88, 2, 50)); // 2
2console.log(Math.max(10, 4, 88, 2, 50)); // 88
3 
4// Tip: Use spread operator (...) with Arrays!
5const testScores = [84, 92, 78, 99, 65];
6console.log(Math.max(...testScores)); // 99

4. Powers and Square Roots

1// Power (x raised to y):
2console.log(Math.pow(3, 4)); // 81 (Equivalent to 3 ** 4)
3 
4// Square Root:
5console.log(Math.sqrt(64)); // 8
6 
7// Cube Root (ES6):
8console.log(Math.cbrt(27)); // 3

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What is the result of Math.floor(7.9)?
Question 2
What is the result of Math.ceil(2.1)?
Question 3
How do you find the maximum value in an array [12, 45, 9] using Math.max?
Question 4
What does Math.abs(-42) return?
Question 5
Can you instantiate the Math object with new Math()?
Next Lesson

Random Numbers Example

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Working with Date ObjectRandom Numbers Example

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master JavaScript for Beginners with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext