I've create a custom functions in JavaScript for ease coding cause its too repetitive to type those function again and again.
What I do is I created an external JavaScript and linked it to my _Layout.cshtml
. I've successfully called them without any problem but what I wanted now is to have those custom function to have intellisense.
global_functions.js
function ZeroPrefixFormat(str, len) {
str = str.toString();
return str.length < len ? ZeroPrefixFormat("0" + str, len) : str;
// OUTPUT : 10 -> 00010 (DIFFERS FROM THE GIVEN LENGTH)
}
function MoneyFormat(amount) {
amount = amount.toString();
return Number(amount).toLocaleString('en');
// RETURN raw number to money format example. 123456789.10 -> 123,456,789.10
}
custom.cshtml
<script>
console.log(MoneyFormat(123456789));
<script>
So when I try to type Money it shows intellisense.