{"id":7448,"date":"2021-08-05T12:23:32","date_gmt":"2021-08-05T12:23:32","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=7448"},"modified":"2022-04-13T16:30:46","modified_gmt":"2022-04-13T16:30:46","slug":"global-javascript-methods","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/","title":{"rendered":"Global JavaScript Methods"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Global JS Methods<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScript global methods can be used on all JavaScript data types.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Number ( )<\/strong><\/li><li><strong>parseFloat ( )<\/strong><\/li><li><strong>parseInt ( )<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Number ( )<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Number() function converts the object argument to a number that<br>represents the object&#8217;s value.<br>If the value cannot be converted to a legal number, NaN is returned.<br>If the parameter is a Date object, the Number() function returns the number of<br>milliseconds since midnight January 1, 1970, UTC.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ex: &#8211;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Number(true)<br>Number(\u201c100\u201d)<br>Number(100\/\u201cHello\u201d)<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/e945e7ec936a53fcc02aaaa6289f93d9.js\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\">parseInt ( )<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The parseInt() function parses a string and returns an integer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax:- parseInt(string, radix)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The radix parameter is used to specify which numeral system to be used, for example, a<br>the radix of 16 (hexadecimal) indicates that the number in the string should be parsed from<br>a hexadecimal number to a decimal number.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the radix parameter is omitted, JavaScript assumes the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>If the string begins with &#8220;0x&#8221;, the radix is 16 (hexadecimal)<\/li><li>If the string begins with any other value, the radix is 10 (decimal)<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Only the first number in the string is returned.<br>Leading and trailing spaces are allowed.<br>If the first character cannot be converted to a number, parseInt() returns NaN.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">parseInt ( )<\/h2>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/3fc4fbd96cac35bf5164797e572bf462.js\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\">parseFloat ( )<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The parseFloat() function parses a string and returns a floating-point number. This function determines if the first character in the specified string is a number. If it is, it parses the string until it reaches the end of the number, and returns the number as a number, not as a string.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax: &#8211; parseFloat(string)<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Only the first number in the string is returned!<\/li><li>Leading and trailing spaces are allowed.<\/li><li>If the first character cannot be converted to a number, parseFloat() returns NaN.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">parseFloat ( )<\/h2>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/a6f6af2237a245e416cbf0e057c2d121.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>Global JS Methods JavaScript global methods can be used on all JavaScript data types. Number ( ) parseFloat ( ) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[16],"tags":[4826,5095,5173,2532,5966,5965],"class_list":["post-7448","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-global","tag-javascript","tag-methods","tag-number","tag-parsefloat","tag-parseint"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Global JavaScript Methods - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Global JavaScript Methods - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Global JS Methods JavaScript global methods can be used on all JavaScript data types. Number ( ) parseFloat ( ) [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-05T12:23:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:30:46+00:00\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"Global JavaScript Methods\",\"datePublished\":\"2021-08-05T12:23:32+00:00\",\"dateModified\":\"2022-04-13T16:30:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/\"},\"wordCount\":272,\"commentCount\":0,\"keywords\":[\"Global\",\"Javascript\",\"methods\",\"Number\",\"parseFloat ( )\",\"parseInt ( )\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/\",\"name\":\"Global JavaScript Methods - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-08-05T12:23:32+00:00\",\"dateModified\":\"2022-04-13T16:30:46+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/global-javascript-methods\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Global JavaScript Methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Global JavaScript Methods - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/","og_locale":"en_US","og_type":"article","og_title":"Global JavaScript Methods - scmGalaxy","og_description":"Global JS Methods JavaScript global methods can be used on all JavaScript data types. Number ( ) parseFloat ( ) [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/","og_site_name":"scmGalaxy","article_published_time":"2021-08-05T12:23:32+00:00","article_modified_time":"2022-04-13T16:30:46+00:00","author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"Global JavaScript Methods","datePublished":"2021-08-05T12:23:32+00:00","dateModified":"2022-04-13T16:30:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/"},"wordCount":272,"commentCount":0,"keywords":["Global","Javascript","methods","Number","parseFloat ( )","parseInt ( )"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/","name":"Global JavaScript Methods - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-08-05T12:23:32+00:00","dateModified":"2022-04-13T16:30:46+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/global-javascript-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Global JavaScript Methods"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=7448"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7448\/revisions"}],"predecessor-version":[{"id":7455,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7448\/revisions\/7455"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=7448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=7448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=7448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}