The USPTO Registered Logo Badge of the Medical Marijuana Initiative of North America - International Limited, an Arizona Benefit Corporation to the left of Mt Hood sunlit from the northwest in June followed by the proprietary MMINAIL octocopter delivery bot.

Altering the Constant in Javascript


Welcome! This is the Altering the Constant in Javascript page of the MMINAIL.


Introduction


The Altering the Constant in Javascript program renders a series of outputs to the console based on given unalterable constants and mutable variables from a hypothetical corporation.


Rendering the Result


Ok ... it's time to give this program a whirl!


Firefox Web-console Instructions


Open up a new window in the Firefox browser.

Next, click on the 'open menu' aka the 'three horizontal bars' icon to the far right of the now un-populated 'enter an address' ( search ) bar.

Then, select the category 'Developer' . This will jump you to the Web Developer tool set Sub-menu.

Once at the Web Developer tool set Sub-menu, click on 'Web Console' to open up a code window.

There, you will see an input line at the bottom of the console.

You will now wish to go ahead and copy and paste our code into the program entry line at the bottom of the console.

Note. You can clear the Firefox Web-console by clicking on the Trash icon   at the top of the console.

Also, be sure to purge the browser memory prior to execution by re-setting ie.) re-loading the browser window.

Now, copy and paste our completed code from the given (.js) file into the program entry line at the bottom of the Firefox Web-console.

Then, hit the Enter key to place the program in the browser's memory.

Depending on the type of program being entered, there may be instantaneous execution, or there may be a pause.

If there is a pause, a second step that executes the program must be entered.


Displaying the Program


Note. In EcmaScript 5, we accommodate small screens in landscape mode when highlighting a code block through the use of the '\' back-slash key when seperating otherwise un-terminated string literals, as follows:


The program as is, written in Javascript ... with 'back-slashes'
//Set the constants
const TAX_RATE = 0.25;
/* where TAX_RATE is a decimal percentage */
const SHARES = 10000;
/* where the issued and outstanding SHARES \
are expressed in the number of voting units */
const DIV_RATE = 0.05;
/* where DIV_RATE is expressed in \
cents per share */

//Set the variables
var gr = 10000;
/* where gr = Gross Revenue */
var cgs = 4000;
/* where cgs = Cost of Goods Sold */
var oi = gr - cgs;
/* where oi = Operating Income */
var exp = 3500;
/* where exp = Expenses Paid */
var ti = oi - exp;
/* where ti = Taxable Income */
var ct = ti * TAX_RATE;
/* where ct = Corporate Tax */
var ni = ti - ct;
/* where ni = Net Income */
var eps = ni/SHARES;
/* where eps = Earnings Per Share */
var dp = SHARES * DIV_RATE;
/* where dp = Dividend Paid */
var re = ni - dp;
/* where re = Retained Earnings */

//Set and Flash Gross Revenue
console.log("gross revenue = " + gr);
let GR = "$" + String(gr.toFixed(2));
window.alert("The gross revenue received \
by your company for the tax year of \
2000 is " + GR + " USD");

//Set and Flash Cost of Goods Sold
console.log("cost of goods sold = " + cgs);
let CGS = "$" + String(cgs.toFixed(2));
window.alert("The cost of goods sold \
required to directly generate your gross \
revenue in the year 2000 is " + CGS + " USD");

//Set and Flash Operating Income
console.log("operating income = " + oi);
let OI = "$" + String(oi.toFixed(2));
window.alert("Therefore, the operating income \
generated by your company in the year \
2000 is " + OI + " USD");

//Set and Flash Expenses
console.log("expenses = " + exp);
let EXP = "$" + String(exp.toFixed(2));
window.alert("The expenses of your \
operation that are allowed to be \
indirectly deducted from your operating \
income subtotal are " + EXP + " USD");

//Set and Flash Taxable Income
console.log("taxable income = " + ti);
let TI = "$" + String(ti.toFixed(2));
window.alert("Your taxable income \
( Before Tax ) is therefore \
" + TI + " USD");

//Set and Flash Corporate Tax
console.log("corporate tax = " + ct);
let CT = "$" + String(ct.toFixed(2));
window.alert("Your corporate tax is \
based on a rate of " + TAX_RATE*100 \
+ "% of taxable income and is " \
+ CT + " USD for the tax year of 2000.");

//Set and Flash Net Income
console.log("net income = " + ni);
let NI = "$" + String(ni.toFixed(2));
window.alert("Your net income \
( After Tax ) is therefore " \
+ NI + " USD");

//Set and Flash Earnings Per Share
console.log("earnings per share = " + eps);
let EPS = "$" + String(eps.toFixed(4));
window.alert("Your earnings per share \
( Before Dividend Paid ) is " + EPS + " USD");

//Set and Flash Dividend Paid
console.log("dividend paid = " + dp);
let DP = "$" + String(dp.toFixed(2));
window.alert("Your aggregate dividend paid \
to shareholders is " + DP + " USD");

//Set and Flash Retained Earnings
console.log("retained earnings = " + re);
let RE = "$" + String(re.toFixed(2));
window.alert("Therefore, the aggregate \
amount of earnings per share retained \
by your company for future business use \
is " + RE + " USD");

//Set and Flash a Closing Line
window.alert("Thank you for engaging the \
'Altering the Constant' program. Please see \
the console log for a list of \
the results of your calculations.");
Time to execute!

Go ahead and follow the above Firefox Web-console Instructions to execute the program.


Strict Mode


Now, that works fine. But, how will the code execute in Strict Mode? One way to find out is to transfer our code to a (.js) page and invoke Strict Mode at the top of the program.

Invoke Strict Mode ...
1
2
//Strict Objects
'use strict';
Place at the top of program.

Let's try that.

Transferring the above highlighted code block to a (.js) page ... Eliminating the back-slashes ...


Now, open up the (.js) file is a separate browser window and copy and paste the code into the Firefox Web-console. Then, hit Enter.


Looks good!


Template Literals Using Back-ticks


Though our program works fine in either traditional EcmaScript 5 safe mode, or in EcmaScript 6 strict mode ... something new is missing.

Namely, the use of `backticks` to accommodate the long window alerts with calls to locally declared, block scope variables, or let(s).

Let's replace those really long window alerts with multi-line Template Literals enclosed in `backticks` to see what happens.

More to come ...

Note. In EcmaScript 6, we accommodate small screens in landscape mode when highlighting a code block through the use of the '`' back-tick key when seperating otherwise un-terminated string literals, as follows:


The program as is, written in Javascript ... with 'back-ticks'
//Set the constants
const TAX_RATE = 0.25;
/* where TAX_RATE is a decimal percentage */
const SHARES = 10000;
/* where the issued and outstanding SHARES 
are expressed in the number of voting units */
const DIV_RATE = 0.05;
/* where DIV_RATE is expressed in 
cents per share */

//Set the variables
var gr = 10000;
/* where gr = Gross Revenue */
var cgs = 4000;
/* where cgs = Cost of Goods Sold */
var oi = gr - cgs;
/* where oi = Operating Income */
var exp = 3500;
/* where exp = Expenses Paid */
var ti = oi - exp;
/* where ti = Taxable Income */
var ct = ti * TAX_RATE;
/* where ct = Corporate Tax */
var ni = ti - ct;
/* where ni = Net Income */
var eps = ni/SHARES;
/* where eps = Earnings Per Share */
var dp = SHARES * DIV_RATE;
/* where dp = Dividend Paid */
var re = ni - dp;
/* where re = Retained Earnings */

//Set and Flash Gross Revenue
console.log("gross revenue = " + gr);
let GR = "$" + String(gr.toFixed(2));
window.alert("The gross revenue received \
by your company for the tax year of #2000 \
is " + GR + " USD");

//Set and Flash Cost of Goods Sold
console.log("cost of goods sold = " + cgs);
let CGS = "$" + String(cgs.toFixed(2));
window.alert("The cost of goods sold \
required to directly generate your gross \
revenue in the year 2000 is " + CGS + " USD");

//Set and Flash Operating Income
console.log("operating income = " + oi);
let OI = "$" + String(oi.toFixed(2));
window.alert("Therefore, the operating income \
generated by your company in the year #2000 \
is " + OI + " USD");

//Set and Flash Expenses
console.log("expenses = " + exp);
let EXP = "$" + String(exp.toFixed(2));
window.alert("The expenses of your \
operation that are allowed to be \
indirectly deducted from your operating \
income subtotal are " + EXP + " USD");

//Set and Flash Taxable Income
console.log("taxable income = " + ti);
let TI = "$" + String(ti.toFixed(2));
window.alert("Your taxable income \
( Before Tax ) is therefore \
" + TI + " USD");

//Set and Flash Corporate Tax
console.log("corporate tax = " + ct);
let CT = "$" + String(ct.toFixed(2));
window.alert("Your corporate tax is \
based on a rate of " + TAX_RATE*100 \
+ "% of taxable income and is " \
+ CT + " USD for the tax year of 2000.");

//Set and Flash Net Income
console.log("net income = " + ni);
let NI = "$" + String(ni.toFixed(2));
window.alert("Your net income \
( After Tax ) is therefore " \
+ NI + " USD");

//Set and Flash Earnings Per Share
console.log("earnings per share = " + eps);
let EPS = "$" + String(eps.toFixed(4));
window.alert("Your earnings per share \
( Before Dividend Paid ) is " + EPS + " USD");

//Set and Flash Dividend Paid
console.log("dividend paid = " + dp);
let DP = "$" + String(dp.toFixed(2));
window.alert("Your aggregate dividend paid \
to shareholders is " + DP + " USD");

//Set and Flash Retained Earnings
console.log("retained earnings = " + re);
let RE = "$" + String(re.toFixed(2));
window.alert("Therefore, the aggregate \
amount of earnings per share retained \
by your company for future business use \
is " + RE + " USD");

//Set and Flash a Closing Line
window.alert("Thank you for engaging the \
'Altering the Constant' program. Please see \
the console log for a list of \
the results of your calculations.");
Time to execute!

Go ahead and follow the above Firefox Web-console Instructions to execute the program.


    Finito! 

Supporting Content Small The Flammarion Logo Badge Small The Flammarion Logo Badge


Welcome! This is the Supporting Content section for the Constant Altering page of the MMINAIL.

The Concept Library of the MMINAIL is a static informational website.

As such, a Supporting Content section is placed below each (.html) page in the flow of the default layout to grant the end-user additional pertinent information when navigating this site.


E Books


With today's explosion of modern devices ...

Some consumers like to read their articles on their Kindles or iPads.

Therefore, a method to convert any page of this website into an eBook ...

Is auto-built into the top of the Navigation <aside> ...

As well as in the <footer> of every page.


Dot ePub

Simply click the following eBook icon = small dot epub button eBook icon to render the current page as an Overdrive (.epub) or a FB Reader (.mobi) .


Apple iBooks

The Apple iBooks platform also reads and displays the (.epub) format, as well.

When navigating the menu at the Navigation <aside> ...

Look for the book icon to download the offered eBook directly to your machine.

Then, simply right-click over the newly downloaded (.epub) and open up the file in the new Book app for Mac devices.


Secure Hyperlinks


The A's Have It!

In today's complicated world of coding, even the use of the standard hyperlink ...

<a href="" title="" target=""></a>

Is placed into question by the standards of newer, more modern browsers such as Google's V8 powered Chrome browser.


Safe Internal Links


Therefore, to make life easy for the end-user ...

The MMINAIL will show safe, internal links in the bootstrap default color of light dodger blue.


Safe External Links


In addition, safe external links ...

When designated https secure ie.) https://.

Will also be shown in the color of light dodger blue.


Standard External Links


All other external links ...

If designated with standard http ie.) http:// ...

Will be shown in the color of indian red.


How To Navigate This Website


At this website ...

We have the <html> hub for the Benefit Corp aka our Concepts Library.

You (Usted), as a current visitor to our Concepts Library, are now at the Constant Altering page.


Navigation Aside


In the Navigation <aside> section of this website ...  ...

The end-user will find a Stack of Topics.

Or, for you smartphone users ... the Navigation <aside> section is up! ...  

There, the smartphone user will find the same Stack of Topics for the Concepts Library at MMINAIL.


Stack O Topics


The Navigation <aside> section to your right ... ... If you are viewing this page from the traditional landscape style of your laptop.

Or, the Navigation <aside> section from above ... ... If you are viewing this page from the modern portrait style of your smartphone ...

Both house the same Stack of Topics available for selection at the Concepts Library of the MMINAIL.


Instruction Set


To access one of the Articles or Lessons available for your preferred Topic of Interest ...

  • Simply scroll through the tabs of Topics above, or to the side ...

  • And, click on one that you may have an interest in.

Back Home


Note. At each Topic of Interest, the end-user will find a hyperlink back to the Home page of the Concepts Library.

By clicking on the Home icon   the end-user will be returned to the Home page of the Concepts Library.


Subtopics


When an end-user clicks on a Topic of Interest ...

Either above  ...

Or, over at  ...

The Stack of Topics in the Navigation <aside> section ...

The menu explodes vertically to reveal several subtopical choices.

To select any other Topic of Interest, or any of the many subtitles ...

  • Simply click on the corresponding glyphicon to open up the referenced file.

Unstuck


If you get stuck ...

  • Simply click on the Home icon   to be hyperlinked back to the Home page of the Concepts Library.

Screen Responsiveness


The pages of the Concept Library have been tested for mobile responsiveness.

The authors have determined the accuracies of the page renderings at both a portrait width of 360px and a landscape width of 640px.


Devices


Testing devices have included selections from the following list of devices ...

  • Amazon Kindle Fire HDX 7, 3rd Generation tablet

  • Virtual Galaxy S5 smartphone emulator

Kindle Tablets

On the Kindle tablet, both portrait and landscape renderings appear accurate.


Amazon Fire Phones

And, on the Amazon Fire phone, using automatic screen rotation, both portrait and landscape renderings appear accurate.


Foreign Language


The foreign language expression ¡Finito! can hold a translation from Spanish-To-English ...

Via the <title> tag.

Simply hover over the word in Spanish to reveal its English equivalent.

For example ...

Hovering over the Spanish phrase ¡Por ejemplo! reveals the English equivalent of "For Example".

Try it!


Acronyms


For an acronym to be visually effective when reading a line of text ...

The acronym must first be declared.

In addition, the acronym must stand out from the body of information.

To accomplish both of these objectives, the MMINAIL has selected Ashley Gold.


Ashley Gold

Ashley gold is a primary color within the registered Logo Badge of the Benefit corporation.

Whenever the end user spies a designated Acronym of Ashley Gold ...

Simply hover over the Acronym to reveal the underlying meaning embedded in the title element of the <abbr> tag.


Definitions


The <abbr> tag can also be used to house Definitions as well as Acronyms.

As we have seen in the above referenced Ashley Gold definition ...

Whenever the end-user spies a designated Acronym or Definition of Ashley Gold color ...

Simply hover over the Acronym or Definition to reveal the underlying meaning embedded in the title element of the <abbr> tag.


Carriage Return


The carriage return, or ... ➡️

The carriage return is used extensively throughout the working repos of the Concept Library to prevent the overflow of raw code.

By preventing the overflow of raw code when rendering a code block, the view of the end-user avoids the slider effect.

And, by eliminating the slider effect, responsive views using other devices ie.) Kindle Fire HDX will maintain screen boundaries without overflow.


Site Monitoring


Note. The Http Headers of this repo are being monitored by Internet Supervision dot com.


Reproduction In Part


Most authors will allow for the reproduction of their works in part ...

When the case of brief quotations embodied in critical articles or reviews is addressed.

As long as an appropriate citation is presented concurrent with the review, authors are generally receptive.

Therefore, please remember to provide a Link-back to the original author, or to the publisher of the original publication when citing.

Thank you for your consideration.

Got An Idea?


If you have an idea that will spruce this site up even better than it already is ...

Then, you know the drill ...

Simply go ahead and fork this repo, make your changes, and send us a pull request.


Coding Community


If you are an expert in your field of specialty ...

Why not fork our Concept Library and create a new Topic of your choosing, or embellish upon an existing Topic.


Pull Requests


Send us a Pull Request.

Our team of coders will review your contribution and get back to you with a "thumbs up" ( or, "thumbs down" ).


Can You Contribute Code?


As we can now decipher the time spent by our functions at the code block level ...

How much of your coding time are you willing to invest in this project?

As we rely heavily upon contributions from the coding community, your contribution of code will be greatly appreciated.

Thank you for your effort and participation in our program to code the globe!


Can You Contribute Cash?


If you have enjoyed and benefited from this article ...

Then, why not drop a little change in our digital bucket at the Square Up - Cash Me donation portal.

As we can now spend the equivalent of our grandparents' monthly mortgage payment at our local Sunday football games ...

How much of your spare cash are you willing to invest in this project?


Starving Coders

As we rely heavily upon contributions from the coding community, your contribution of cash will be greatly appreciated.

Note. Your donation will help us fund our Starving Coders initiative through our Medcoin™ Crypto Currency Division.


Can You Contribute Ether?


As we have witnessed the exponential growth of Bitcoin (BTC) from 9 cents USD per coin ...

To over $18,000 USD per coin over the past nine (9) years.

Plus, the recent explosion of Ripple (XRP) from less than one-penny to over $2 USD.

How much of your spare Ether ( ETH ) are you willing to invest in this project?

As we rely heavily upon contributions from the coding community, your contribution of ether will be greatly appreciated, as well.


Public Hash

Simply scan the following QR Code to extract our Coinbase public hash address to send Gifts O Wei in support of our Medcoin™ Crypto Currency Project.

QR Code - Coinbase - Bus Card

Note. The easiest and safest way to extract our public `ETH` hash-address is to point your smartphone at the `QR Code` shown and engage the `Sophos Intercept X QR Code Scanner`. From there you will be able to open the link safely via the `Sophos Intercept X Link Checker`.


No Warranty


Disclaimer. The author of this website has made every effort to ensure accuracy ...

However, the information contained in this website, and in its pages, is offered to the public without any warranty expressed or implied.

Therefore, the author of this website, and by extension its pages and content cannot be held liable for any damages that may be caused indirectly or directly by the software instructions or tutorials contained in the pages of this website.


License


The license and privacy policy pages ...

For further review, please see the License page and the Privacy Policy page of this website to clarify.


Copyright © 2000 - 2021

The Medical Marijuana Initiative of North America Small Registered MMINAIL™ Logo Badge Small Registered MMINAIL™ Logo Badge
- International Limited Small R-Reggae™ Trademark Symbol Logo Badge Small R-Reggae™ Trademark Symbol Logo Badge