If you are not sure if the website you would like to visit is secure, you can verify it here. Enter the website address of the page and see parts of its content and the thumbnail images on this site. None (if any) dangerous scripts on the referenced page will be executed. Additionally, if the selected site contains subpages, you can verify it (review) in batches containing 5 pages.
favicon.ico: javascript-tutorial.com/built-in-objects/math - Math - The complete JavaScript.

site address: javascript-tutorial.com/built-in-objects/math/ redirected to: javascript-tutorial.com/built-in-objects/math

site title: Math - The complete JavaScript Tutorial

Our opinion (on Thursday 19 November 2026 4:55:38 UTC):

GREEN status (no comments) - no comments
After content analysis of this website we propose the following hashtags:



Meta tags:

Headings (most frequently used words):

math, javascript, the, for, web, objects, properties, methods, summary, chapter, article, toc, about, getting, started, basics, control, structures, data, types, built, in, operators, functions, classes, error, handling, regular, expressions, general, bom, dom, ceil, floor, max, min, random, round, trunc,

Text of the page (most frequently used words):
the (88), math (85), and (35), alert (29), result (24), methods (22), number (22), round (20), #javascript (18), object (18), you (17), for (17), method (17), this (13), ceil (13), floor (13), with (13), will (13), that (12), max (11), random (11), introduction (11), here (10), have (10), integer (10), can (10), min (10), between (9), down (8), trunc (7), but (7), example (7), approximately (7), properties (7), need (6), more (6), built (6), already (6), nearest (6), function (6), operators (6), article (5), mathematical (5), numbers (5), floating (5), point (5), examples (5), what (5), while (5), are (5), like (5), always (5), some (5), functions (5), objects (5), operator (5), not (4), list (4), doing (4), operations (4), seen (4), reference (4), see (4), used (4), works (4), from (4), just (4), return (4), found (4), static (4), contains (4), useful (4), logarithm (4), array (4), tutorial (3), into (3), your (3), json (3), date (3), basic (3), when (3), than (3), integers (3), want (3), let (3), should (3), rounded (3), easily (3), getrandomnumber (3), output (3), 255 (3), generate (3), well (3), how (3), base (3), natural (3), other (3), web (3), regular (3), expressions (3), catching (3), basics (3), language (2), previous (2), quite (2), simple (2), complex (2), comes (2), all (2), full (2), please (2), summary (2), different (2), rounding (2), actually (2), bit (2), part (2), only (2), couple (2), last (2), positive (2), whether (2), instance (2), default (2), returns (2), 163 (2), range (2), where (2), minimum (2), specific (2), since (2), fact (2), either (2), make (2), exclusive (2), multiply (2), create (2), control (2), then (2), using (2), both (2), which (2), below (2), show (2), most (2), mind (2), directly (2), they (2), about (2), square (2), root (2), several (2), them (2), instead (2), discussed (2), chapter (2), call (2), asp (2), net (2), dom (2), window (2), bom (2), search (2), error (2), types (2), conditional (2), errors (2), try (2), catch (2), fields (2), inheritance (2), getters (2), setters (2), prototypes (2), values (2), parameters (2), string (2), loops (2), statement (2), toc (2), localization, suggest, correction, contact, com, 2007, 2026, has, been, fully, translated, following, languages, preferred, help, translate, click, czech, next, articles, handy, remember, haven, covered, available, documentation, three, fourth, variant, because, simply, removing, fractional, leaving, illustrate, does, value, exactly, two, however, many, situations, may, question, decide, fortunately, previously, our, line, 11894979340966, falls, arbitrary, clever, accomplish, created, takes, maximum, parameter, within, get, 99999999, use, notice, vary, included, 5611124673777659, often, find, self, situation, produce, something, usually, starts, generating, inclusive, biggest, opposite, smallest, take, unlimited, highest, one, again, looking, look, action, rounds, never, might, obvious, choice, requirements, commonly, discuss, necessary, relevant, interesting, relates, cos, sin, cosine, sine, skip, these, basically, related, bunch, mentioned, currently, place, talk, 414, sqrt2, 707, sqrt1_2, 14159, representing, ratio, circumference, circle, its, diameter, 442, log2e, 434, log10e, 693, ln2, 302, ln10, logarithms, euler, aspects, advanced, relate, actual, therefore, won, showing, quick, links, their, case, dig, deeper, examine, kind, expect, unlike, words, passing, work, also, means, new, members, ones, addition, subtraction, multiplications, quickly, appreciate, lot, heavy, stuff, wpf, php5, jquery, html5, css3, webforms, mvc, location, history, script, tag, general, replace, capturing, groups, match, regex, flags, options, throwing, finally, handling, classes, extension, property, accessors, multiple, recursive, callback, anonymous, optional, chaining, nullish, coalescing, ternary, remainder, logical, modify, assign, increment, decrement, arithmetic, comparison, assignment, type, conversion, null, undefined, strings, booleans, data, switch, structures, truthy, falsy, variables, syntax, hello, world, tools, getting, started, libraries, webbrowser, table, contents, complete,


Text of the page (random words):
math the complete javascript tutorial javascript tutorial toc table of contents chapter article toc introduction number string array the basics array methods date math math properties math methods math ceil math floor math max math min math random math round math trunc summary json about javascript what is javascript javascript and the webbrowser javascript libraries getting started the tools you need hello world the basics basic javascript syntax variables truthy falsy control structures the if statement the switch statement loops for and while loops for of and for in data types introduction booleans numbers strings null undefined type conversion built in objects introduction number string array the basics array methods date math json operators introduction the assignment operator comparison operators arithmetic operators increment decrement operators modify and assign operators logical operators remainder operator conditional ternary operator nullish coalescing operator optional chaining operator functions introduction function parameters function parameters with default values anonymous functions callback functions recursive functions multiple return values objects introduction properties methods property accessors getters setters prototypes prototypes inheritance extension classes introduction fields methods getters setters inheritance static fields methods error handling introduction catching errors try catch catching throwing errors try catch finally error types conditional catching regular expressions introduction regex flags options search match with regular expressions using capturing groups search replace with regular expressions javascript for web general introduction window dom bom the script tag javascript for web the bom the window object the history object the location object javascript for web the dom introduction javascript asp net mvc asp net webforms c css3 html5 jquery php5 wpf built in objects math when you need to do more complex mathematical operations than the ones we have already discussed like basic addition subtraction multiplications and so on then you will quickly appreciate the built in math object it contains a lot of methods for doing more heavy mathematical stuff as well as some useful properties unlike several of the other built in objects we have already discussed in this chapter the math object contains only static members in other words you can t just call the math methods on e g a number object instead you will have to reference the properties and methods on the math object while passing in the number s you want to work on it also means that you can t create a new math object or call it like a function as we ve seen with some of the other built in objects with that in mind let s examine what kind of useful properties and methods we can expect from the math object math properties the math object contains several properties which are useful for different aspects of doing advanced mathematical operations since they directly relate to actual math and are therefore not specific to javascript i won t be showing you examples of all of them instead here s a quick list with links to their reference in case you want to dig deeper into them math e euler s number the base of natural logarithms math ln10 the natural logarithm of 10 approximately 2 302 math ln2 the natural logarithm of 2 approximately 0 693 math log10e the base 10 logarithm of e approximately 0 434 math log2e the base 2 logarithm of e approximately 1 442 math pi approximately 3 14159 representing the ratio of the circumference of a circle to its diameter math sqrt1_2 the square root of 1 2 approximately 0 707 math sqrt2 the square root of 2 approximately 1 414 with that in place let s talk about the methods of the math object math methods the math object contains a bunch of useful static methods but as mentioned currently no instance methods some of the static methods found on the math object directly relates to mathematical functions like math cos and math sin cosine and sine i will skip these methods as they are basically more related to math than javascript for a full list of the methods found on the math object please see this reference with that in mind here s a list of the most relevant and interesting methods found on the math object math ceil the ceil method will round up if necessary a number to the nearest integer here s a couple of examples to show how it works result 4 already an integer alert math ceil 4 result 1 alert math ceil 0 95 result 7 alert math ceil 6 01 result 8 alert math ceil 7 95 the fact that it always rounds up the number and never down might not make it the obvious choice for most rounding requirements the math round method is more commonly used we ll discuss it below math floor while the ceil method will always round up the math floor method will always round down to the nearest integer here s some examples to show it in action result 4 already an integer alert math floor 4 result 0 alert math floor 0 95 result 6 alert math floor 6 01 result 7 alert math floor 7 95 and again if you re looking for a method which will round up or down and not always down have a look at math round below math max the max method will take an unlimited but minimum 2 numbers and return the highest one it works for both integers and floating point numbers here s how it can be used result 2 alert math max 1 2 result 8 alert math max 1 8 2 result 0 97 alert math max 0 95 0 97 0 01 result 10 01 alert math max 4 7 97 10 01 math min while the max method returns the biggest number the min method will do the opposite and return the smallest number and just like the max method it works with both integers and floating point numbers here are some examples result 1 alert math min 1 2 result 2 alert math min 10 8 2 result 0 01 alert math min 0 95 0 97 0 01 result 4 01 alert math min 4 01 7 97 10 math random you will often find your self in a situation where you need to produce something random and usually that starts with generating a random number we can do this in javascript using the random method found on the math object this method always generate a random floating point number between 0 inclusive and 1 exclusive here s an example example output 0 5611124673777659 alert math random but what if you need this number to be a positive integer well we can just multiply it with a number and then round it like this a number between 0 and 9 alert math floor math random 10 a number between 1 and 10 alert math ceil math random 10 i multiply by 10 to create a number between 0 and 10 but notice how i vary between the ceil and floor methods to control whether 0 and 10 are included since the number we get from the random method is between 0 and 0 99999999 the fact that we either round up or down to the nearest integer will make either 0 or 10 exclusive when we use the ceil and floor method but what if we need to generate a number that falls between an arbitrary range e g between 1 and 255 well with a bit of clever math we can accomplish this quite easily here s an example where i have created a function that takes a minimum and a maximum parameter to easily generate a number within a specific range function getrandomnumber min max return math random max min min example output 163 11894979340966 alert getrandomnumber 0 255 example output 163 alert math floor getrandomnumber 0 255 by default our function returns a floating point number but as you can see from the last line of the example we can easily round this to an integer math round we previously used the ceil method to round up to the nearest integer and the floor method to round down to the nearest integer however in many situations you may want to let the number in question decide whether it should be rounded up or down for instance 6 49 should be rounded down to 6 while 6 51 should be rounded up to 7 fortunately we have the math round method for just that result 1 alert math round 0 51 result 10 alert math round 10 42 result 10 alert math round 9 71 result 42 alert math round 41 50 as you can see from the last example javascript will round up if the value is positive and exactly between the two nearest integers math trunc we have already used three different methods for rounding numbers ceil floor and round but javascript actually comes with a fourth variant for doing this the trunc method it s actually a bit more simple than the methods we have already seen because it works by simply removing the fractional part of a floating point number only leaving the integer part here s a couple of examples that will illustrate what it does result 0 alert math trunc 0 51 result 10 alert math trunc 10 42 result 9 alert math trunc 9 71 result 41 alert math trunc 41 50 summary doing basic mathematical operations in javascript is quite simple as we have seen in previous articles when you need to do more complex operations the built in math object comes in handy as we have seen in this article and remember that we haven t covered all available methods in this article for a full reference please see the math object documentation date previous json next this article has been fully translated into the following languages czech is your preferred language not on the list click here to help us translate this article into your language javascript tutorial com 2007 2026 contact us suggest correction localization
Thumbnail images (randomly selected): * Images may be subject to copyright.GREEN status (no comments)

    No Images


    Verified site has: 72 subpage(s). Do you want to verify them? Verify pages:

    1-5 6-10 11-15 16-20 21-25 26-30 31-35 36-40 41-45 46-50
    51-55 56-60 61-65 66-70 71-72


    Top 50 hastags from of all verified websites.

    Supplementary Information (add-on for SEO geeks)*- See more on header.verify-www.com

    Header

    HTTP/1.1 302 Redirect
    Content-Type text/html; charset=UTF-8
    Location htt????/javascript-tutorial.com/built-in-objects/math/
    Server Microsoft-IIS/10.0
    X-Powered-By ASP.NET
    Date Thu, 19 Nov 2026 04:55:38 GMT
    Connection close
    Content-Length 177
    HTTP/2 200
    cache-control private
    content-type text/html; charset=utf-8
    server Microsoft-IIS/10.0
    set-cookie ASP.NET_SessionId=xm33ng2aduhqevt4lpj0jvkj; path=/; HttpOnly; SameSite=Lax
    x-aspnetmvc-version 5.2
    x-aspnet-version 4.0.30319
    x-powered-by ASP.NET
    date Thu, 19 Nov 2026 04:55:38 GMT
    content-length 30781

    Meta Tags

    title="Math - The complete JavaScript Tutorial"
    name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"

    Load Info

    page size30781
    load time (s)0.144648
    redirect count1
    speed download213756
    server IP 142.132.248.53
    * all occurrences of the string "http://" have been changed to "htt???/"