This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Simple value assignment | |
const age = 20; | |
const status = age >= 18 ? 'Adult' : 'Minor'; | |
// status = 'Adult' | |
2. Function return | |
function getFee(isMember) { | |
return isMember ? '$2.00' : '$10.00'; | |
} | |
getFee(true); // Returns "$2.00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const paramsString = "q=URLUtils.searchParams&topic=api"; | |
const searchParams = new URLSearchParams(paramsString); | |
// Iterating the search parameters | |
for (const p of searchParams) { | |
console.log(p); | |
} | |
console.log(searchParams.has("topic")); // true | |
console.log(searchParams.has("topic", "fish")); // false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set arg1=%* | |
set message="%*" | |
git add . | |
git commit -m %message% | |
git push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileOverview Javascript high precision calculate | |
* @author GGF ([email protected]) | |
* @version 0.1 | |
* @see {@link http://usejsdoc.org|jsdoc} | |
* @example | |
* | |
* 0.05 + 0.01 //0.060000000000000005 | |
* 1.0 - 0.42 //0.5800000000000001 | |
* 4.015 * 100 //401.49999999999994 |