Prototype.call() vs Prototype.apply()

This is going to be a relatively short post.  We have been doing a lot of [x] vs [y] vs [z] posts lately and this one is no different.  Today, I figured that we would look at Prototype.call() vs Prototype.apply().  Both apply() and call() are used to invoke functions.  The difference is that call uses …

Continue reading "Prototype.call() vs Prototype.apply()"

Playing with the OpenWeather API: The basics

Ever since Apple bought and shut down Dark Sky, I have been struggling to figure out what to replace it with.  I figured that this would be a good excuse to play with some weather APIs.  I have done this once before but that was with Rivets and YQL (neither of which I can necessarily …

Continue reading "Playing with the OpenWeather API: The basics"

Object.seal() vs Object.freeze()

So, you want to protect an object that you created in JavaScript?  With Object.seal() and Object.freeze(), you have two solid options that do slightly different things.  While Object.seal() prevents new properties from being added to the object and marks all existing properties as non-configurable, it still lets you change the values of properties.  Object.freeze() on …

Continue reading "Object.seal() vs Object.freeze()"

Cookies vs localStorage vs sessionStorage in JavaScript

Back in 2012, I posted How to store JavaScript values persistently, locally (a post that is apparently a bit broken).  I figured that it might be time to revisit the topic. Let’s start by looking at how to create and read cookies, first. See the Pen How to use cookies! by Joe Steinbring (@steinbring) on …

Continue reading "Cookies vs localStorage vs sessionStorage in JavaScript"

3 ways to concatenate strings with JavaScript

I genuinely thought that I had covered this topic already.  It appears that the closest that I came was “PHP: Fun with strings” (back in 2014), so let’s do it now? See the Pen String concatenation in JavaScript by Joe Steinbring (@steinbring) on CodePen. The three methods that I’m using about are concat(), “[string 1] …

Continue reading "3 ways to concatenate strings with JavaScript"
Glue

How do you interact with the clipboard using JavaScript?

This should be a pretty quick post.  I wanted to explore how to Copy/Cut/Paste on a webpage.  I figured how to do Copy and Cut pretty easily but Paste was a different story. See the Pen Copy/Cut/Paste text to clipboard demo by Joe Steinbring (@steinbring) on CodePen. So, why isn’t paste working in the pen?  …

Continue reading "How do you interact with the clipboard using JavaScript?"

I created a new website

I haven’t had a lot at jws.app since registering the domain so, I spent a bit of time over the past few weekends and finally built a website there.  The idea was that it pulls recent activity from travels.jws.app, photos.jws.app, blog.jws.app, github, and DEV and auto-updates the website based upon those feeds.  I wanted to …

Continue reading "I created a new website"