Blog

JavaScript – Weighted Randomization

Today I worked on a project which involved weighted randomization. In other words, I had to randomly choose an item from an array of weighted items. The items that were assigned a higher weight were to be more likely to be picked. The following is a JavaScript function that accomplishes Read more…

By Chris West, ago
Blog

JavaScript – Polling

At times you may need to use a polling function in order to wait for an event before the rest of your code can fire. One way we can solve this is with a polling function: Let’s say that you want a function which tells the user when window.myCustomVar is Read more…

By Chris West, ago
Blog

JavaScript – Modify URL Parameters

Recently I had to develop a solution which involved changing the HREF attributes of links in the navigation bar of a site. This had to be done on the JavaScript side because at my company we are the 3rd-party JavaScript solution for modifying other companies’ sites. That being said, I Read more…

By Chris West, ago