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()"

Var vs let vs const in JavaScript

The next post in our X vs Y vs Z series is var vs let vs const.  I’ve wanted to cover this for a little while.  Let and const were added to JavaScript with ECMAScript 6.  Var has been around a bit longer. Var is used to declare a function-scoped or globally-scoped variable.  Var declarations …

Continue reading "Var vs let vs const in JavaScript"

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"

Get a user’s IP Address using just JavaScript (and an API call)

I have used IP Chicken for checking my public IP Address for pretty much 15 years (since hearing about it on TechTV).  Once upon a time, I tried writing my own alternative in ColdFusion but it is a lot of overhead for such a dumb thing.  I started wondering if I could do it with …

Continue reading "Get a user’s IP Address using just JavaScript (and an API call)"

Six ways to use data binding with Vue.js

This is going to be a pretty quick post.  Two weeks ago, we looked at how use watchers in Vue.js.  This week I figured that we would look at computed properties and methods. See the Pen Vue.js Computed Value vs Method vs Variable by Joe Steinbring (@steinbring) on CodePen. In the above example, we are …

Continue reading "Six ways to use data binding with Vue.js"