Skip to content

Instantly share code, notes, and snippets.

View gungunfebrianza's full-sized avatar
:octocat:
Who uses passion, reveals the fortune.

Gun Gun Febrianza gungunfebrianza

:octocat:
Who uses passion, reveals the fortune.
  • PT Rantai Oxygen Indonesia
  • Indonesia
  • 20:13 (UTC -12:00)
  • X @daddybitcoin
View GitHub Profile
@gungunfebrianza
gungunfebrianza / ternary-operator.js
Created June 24, 2025 22:00
One-Line If-Else Statement in JavaScript (Ternary Operator)
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"
@gungunfebrianza
gungunfebrianza / urlSearchParams.js
Created June 24, 2025 11:00
Query string of URL
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
@echo off
set arg1=%*
set message="%*"
git add .
git commit -m %message%
git push
@gungunfebrianza
gungunfebrianza / precision.js
Created September 6, 2018 14:47
High-precision calculation for javascript,You can call add,sub,mul,div to calculate you variables.
/**
* @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