{"id":2102,"date":"2017-07-25T03:30:08","date_gmt":"2017-07-25T03:30:08","guid":{"rendered":"http:\/\/javascript-tutor.net\/?page_id=2102"},"modified":"2017-07-25T04:20:39","modified_gmt":"2017-07-25T04:20:39","slug":"future-value-calculator","status":"publish","type":"page","link":"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/","title":{"rendered":"Future Value Calculator"},"content":{"rendered":"<p>The concept of future value is related to time value of money. For example, if you deposit your money in a bank as a savings account or a fixed deposit account for a certain period of time, you will earn a certain amount of money based on the compound interest computed periodically, and this amount is added to the principal if you continue to keep the money in the bank. Interest for the following period is now computed based on the initial principal plus the interest (the amount which becomes your new principal). Subsequent interests are computed in the same way.<\/p>\n<p>For example, let&#8217;s say you deposited $1000 in a bank and the bank is paying you 5% compound interest annually. After the first year, you will earn an interest of $1000&#215;0.05=$50 . Your new principal will be $1000+$1000&#215;0.05=$1000(1+0.05)=$1000(1.05)=$1050.<\/p>\n<p>After the second year, your new principal is $1000(1.05)x1.05=$1000(1.05)<sup>2<\/sup>=$1102.50. This new principal is called the future value.<\/p>\n<p>Following the above calculation, the future value after n years will be<\/p>\n<blockquote><p><b>FV = PV * (1 + i \/ 100)<sup>n<\/sup><\/b><\/p><\/blockquote>\n<p>Where PV represents the present value, FV represents the future value, i is the interest rate and n is the number of periods (Normally months or years).<\/p>\n<p>We can create a javascript function to compute the future value. \u00a0This function comprises three parameters, PV, interest rate and the number of periods, as follows:<\/p>\n<pre>function FV(PV,i,n){\r\nvar x=(1+i\/100)\r\nvar FV=PV*(Math.pow(x,n))\r\nreturn FV;\r\n}<\/pre>\n<p>The full script is as follows:<\/p>\n<pre>aaaaaa\r\nfunction FV(PV,i,n){\r\nvar x=(1+i\/100)\r\nvar FV=PV*(Math.pow(x,n))\r\nreturn FV;\r\n}\r\nfunction Cal_FV(){\r\nvar pvalue=parseFloat(document.getElementById(\"a\").value);\r\nvar interest=parseFloat(document.getElementById(\"b\").value);\r\nvar num=parseInt(document.getElementById(\"c\").value);\r\nvar fvalue=FV(pvalue, interest, num);\r\nvar fv=fvalue.toFixed(2);\r\ndocument.getElementById('ans').textContent=\"The future value is= \"+fv;\r\n}<\/pre>\n<p>The HTML document to call the Future value function is as follows:<\/p>\n<pre>&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=windows-1252\"&gt;\r\n&lt;title&gt;Future Value Calculator&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;Future Value Calculator&lt;\/h1&gt;\r\n&lt;h3&gt;Please enter the following values and click the Check Answer button to find the Future value:&lt;\/h3&gt;\r\n&lt;p&gt;Present Value&amp;nbsp;=&amp;nbsp;&amp;nbsp;&lt;input type=\"text\" size=\"5\" id=\"a\"&gt;&lt;\/p&gt;\r\n&lt;p&gt;Interest Rate=&amp;nbsp;&lt;input type=\"text\" size=\"5\" id=\"b\"&gt;&lt;\/p&gt;\r\n&lt;p&gt;Number of Years=&amp;nbsp;&lt;input type=\"text\" size=\"5\" id=\"c\"&gt;&lt;\/p&gt;\r\n&lt;h3 id=\"ans\"&gt;&lt;h3&gt;\r\n&lt;input type=\"button\" value=\"Check Answer\" onclick=\"Cal_FV()\"&gt;&lt;br&gt;&lt;br&gt;\r\n&lt;script type=\"text\/javascript\" src=\"FV.js\"&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Click on <a href=\"http:\/\/javascript-tutor.net\/Jsample\/FV.html\">Future Value Calculator<\/a> to view the output<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The concept of future value is related to time value of money. For example, if you deposit your money in a bank as a savings account or a fixed deposit account for a certain period of time, you will earn a certain amount of money based on the compound interest computed periodically, and this amount &hellip; <a href=\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Future Value Calculator&#8221;<\/span><\/a><\/p>\n","protected":false},"author":35895,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2102","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Future Value Calculator - Learn JavaScript Online | Free Interactive JavaScript Tutorials<\/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:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Future Value Calculator - Learn JavaScript Online | Free Interactive JavaScript Tutorials\" \/>\n<meta property=\"og:description\" content=\"The concept of future value is related to time value of money. For example, if you deposit your money in a bank as a savings account or a fixed deposit account for a certain period of time, you will earn a certain amount of money based on the compound interest computed periodically, and this amount &hellip; Continue reading &quot;Future Value Calculator&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn JavaScript Online | Free Interactive JavaScript Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2017-07-25T04:20:39+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/\",\"url\":\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/\",\"name\":\"Future Value Calculator - Learn JavaScript Online | Free Interactive JavaScript Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/javascript-tutor.net\/#website\"},\"datePublished\":\"2017-07-25T03:30:08+00:00\",\"dateModified\":\"2017-07-25T04:20:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/javascript-tutor.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Future Value Calculator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/javascript-tutor.net\/#website\",\"url\":\"https:\/\/javascript-tutor.net\/\",\"name\":\"Learn JavaScript Online | Free Interactive JavaScript Tutorials\",\"description\":\"Master JavaScript with free, interactive tutorials for beginners and experienced coders. Practice live coding and visualize how JavaScript works step by step.\",\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Future Value Calculator - Learn JavaScript Online | Free Interactive JavaScript Tutorials","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:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/","og_locale":"en_US","og_type":"article","og_title":"Future Value Calculator - Learn JavaScript Online | Free Interactive JavaScript Tutorials","og_description":"The concept of future value is related to time value of money. For example, if you deposit your money in a bank as a savings account or a fixed deposit account for a certain period of time, you will earn a certain amount of money based on the compound interest computed periodically, and this amount &hellip; Continue reading \"Future Value Calculator\"","og_url":"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/","og_site_name":"Learn JavaScript Online | Free Interactive JavaScript Tutorials","article_modified_time":"2017-07-25T04:20:39+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/","url":"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/","name":"Future Value Calculator - Learn JavaScript Online | Free Interactive JavaScript Tutorials","isPartOf":{"@id":"https:\/\/javascript-tutor.net\/#website"},"datePublished":"2017-07-25T03:30:08+00:00","dateModified":"2017-07-25T04:20:39+00:00","breadcrumb":{"@id":"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/javascript-tutor.net\/index.php\/future-value-calculator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/javascript-tutor.net\/"},{"@type":"ListItem","position":2,"name":"Future Value Calculator"}]},{"@type":"WebSite","@id":"https:\/\/javascript-tutor.net\/#website","url":"https:\/\/javascript-tutor.net\/","name":"Learn JavaScript Online | Free Interactive JavaScript Tutorials","description":"Master JavaScript with free, interactive tutorials for beginners and experienced coders. Practice live coding and visualize how JavaScript works step by step.","inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/pages\/2102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/users\/35895"}],"replies":[{"embeddable":true,"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/comments?post=2102"}],"version-history":[{"count":8,"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/pages\/2102\/revisions"}],"predecessor-version":[{"id":2110,"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/pages\/2102\/revisions\/2110"}],"wp:attachment":[{"href":"https:\/\/javascript-tutor.net\/index.php\/wp-json\/wp\/v2\/media?parent=2102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}