Skip to content

Instantly share code, notes, and snippets.

View pranesh239's full-sized avatar
⚛️
Focusing

Pranesh pranesh239

⚛️
Focusing
View GitHub Profile
@forcewake
forcewake / extractTextBetweenCurlyBraces.js
Created June 5, 2015 12:55
Getting content between curly braces in javascript regex
var found = [], // an array to collect the strings that are found
rxp = /{([^}]+)}/g,
str = "a {string} with {curly} braces",
curMatch;
while( curMatch = rxp.exec( str ) ) {
found.push( curMatch[1] );
}
console.log( found ); // ["string", "curly"]
@nicbell
nicbell / 1_primitive_comparison.js
Last active September 23, 2022 16:56
JavaScript object deep comparison. Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical. Here is a solution to check if two objects are the same.
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true