Skip to content

Instantly share code, notes, and snippets.

View abhinavnigam2207's full-sized avatar
๐Ÿ˜Ž

Abhinav Nigam abhinavnigam2207

๐Ÿ˜Ž
View GitHub Profile
/* ******************** If Else ********************* */
const integer =7;
let resp = '';
if (integer >= 10) {
resp = '2 digit integer';
} else {
resp = '1 digit integer';
}
/* ******************** If Else/Switch Way ********************* */
const shape = 'circle';
const getArea1 = () => {
if (shape === 'circle') {
getCircleArea();
} else if (shape === 'triangle') {
getTriangleArea();
} else if (shape === 'rectangle') {
getRectangleArea();
@abhinavnigam2207
abhinavnigam2207 / promise-polyfill.js
Last active February 5, 2025 09:26
Promise Polyfill
// Polyfill for Promise()
// -----------------------------
// Syntax Example
// const p = new myPromise(resolve, reject);
const myPromise = function (executer) {
let onResolve, onReject,
isFulfilled = false,
isCalled = false,
value;