Categories
JavaScript Web

JavaScript Remove duplicates from Array – Example Code

Here is the code to remove duplicates from an Array: var distinctVal = function(arr){ var newArray = []; for(var i=0, j=arr.length; i<j; i++){ if(newArray.indexOf(arr[i]) == -1) newArray.push(arr[i]); } return newArray; };

Categories
JavaScript Web

JavaScript Basics: How to check for null & undefined

To check if a variable(a) has the value null, use the following code: if (a === null) // Best way to do it! if (a == null) // This does return true if a is null but it returns true also if a is undefined… so avoid it To check if a variable(a) has the […]

Categories
JavaScript jQuery Web

JavaScript Basics: Difference between == & === (with examples)

JavaScript has two sets of equality operators: === and ==. They mostly work exactly the same ie, if the operands are of the same type and have the same value, then === produces true & so does ==. But if the operands are of different types, then === produces false & == says true. The […]

Categories
JavaScript jQuery Solutions Web

JavaScript Loop Through Select Options – Example

Update (2026): This guide has been updated with modern ES6+ methods and troubleshooting FAQs to ensure it works with the latest web standards and frameworks. Iterating through dropdown (select) options is a fundamental task in web development. Whether you are validating a form, dynamically filtering data, or syncing UI states, knowing how to efficiently loop […]

Categories
Android Apps FaceBook Solutions Web

How to Disable Facebook Links from opening in the Facebook App Browser

Facebook recently update added a new feature to its mobile app. The feature loads all links clicked on Facebook to open in the in-app browser as opposed to a browser installed on the phone. While this is faster, it seriously limits what you can do with the open page (for eg. sharing is limited). But […]