Animations

API

Arrays

Async

Basics

Challenges

Classes

Console

Dates

Debugging

DOM Elements

DOM Methods

DOM Navigation

DOM Properties

Event Listeners

Flow Control

Forms

Functions

Global Functions

JSON

Keywords

Libraries (3rd party)

Math

Modules

Objects

Snippets

String

Types

Widgets

Window Object

JavaScript - Module Demo

This shows the values before and after the are passed thru the methods in the imported modules.

before hello 1000000 100000000 0.42
after

 


import { CapitalizeFirstLetter, FormatAsUSCurrency, AddCommas, ConvertToPercentageString } from './StringUtilities.js';

$(function ()
{
    let msg = "hello";
    $("#demo1").text(CapitalizeFirstLetter(msg));

    let money = 1000000;
    $("#demo2").text(FormatAsUSCurrency(money));

    let longNumber = 100000000;
    $("#demo3").text(AddCommas(longNumber));

    let pct = 0.42;
    $("#demo4").text(ConvertToPercentageString(pct));
});

<script src="~/assets/javascripts/modules/ModuleDemo.js" type="module"></script>