Blog

Archive for the JavaScript Category


In JavaScript Reverse a String without using reverse()
Posted on November 12, 2017 in Algorithms, JavaScript by Matt Jennings

var str = ‘blah’;

function reverseStr(str1) {
var arr1 = str1.split(”);
var arr2 = [];

Read more


Execute JS by URL
Posted on October 25, 2017 in JavaScript by Matt Jennings

var pageUrl = window.location.href;

if(pageUrl.toLocalLowerCase().indexOf(‘mattjennings.net/blog’) != -1) {
// JS to execute here
}

var pageUrl = window.location.href;

if(pageUrl.toLocalLowerCase().indexOf(‘mattjennings.net/blog’) == -1) {

Read more


A Simple jQuery Slideshow
Posted on October 31, 2015 in JavaScript, jQuery by Matt Jennings

See the JSFiddle for this code including the jQuery, CSS, and HTML.


How to Mimic Simulate the input placeholder Attribute in Internet Explorer 9 Using Plain JS and jQuery
Posted on October 31, 2015 in JavaScript, jQuery by Matt Jennings

See this JSFiddle for the code.


Using JavaScript Push Common Numbers from Two Arrays into a Third Array
Posted on July 31, 2015 in Algorithms, JavaScript by Matt Jennings

function commonIdsFromTwoArrays(arr1, arr2) {
// Array to push common IDs into
var commonIdsArr = [];

Read more