One Line at a Time

A blog about learning to code

Variables in PHP

As I’m starting to learn PHP for a new job (hooray!), I thought it might be useful to do a little review on the most basic of topics: variables. While most of the information about variables is similar to Ruby and JavaScript, there are a few important distinctions.

What is JSX, Anyway?

As I was working on my React project for Flatiron School (more about that here), I became interested in the JSX language that was being used. How could I use both HTML and JavaScript seemingly in the same expression? This blog post will explore the basics of JSX and show that while using JSX isn’t necessary, it sure does make using React a lot more convenient!

Sorting an Object in JavaScript

Objects are a great way to store data in JavaScript. They are comparable to objects in real life. According to MDN, an object is “a collection of properties, and a property is an association between a name (or key) and a value.” Unlike an array (which is just a type of object), in standard objects, there is no native way to sort these properties. This past week, for a technical interview, part of the challenge involved sorting the properties of an object. While I won’t get into the specifics of the actual challenge, I thought it would make for an interesting blog post to explain how I went about sorting an object.

Solving the Diagonal Difference Problem

As I was working over the weekend to brush up on my JavaScript problem solving skills on, I came across the Diagonal Difference problem. Given a square matrix, I was tasked with calculating the absolute difference between the sums of its diagonals. At first, I was a bit overwhelmed, but I was able to reason through the problem and come up with (what I think is) a good solution to it. In this blog, I will detail the thought process and reasoning that led me to my answer.

For and While Loops in JavaScript

Since graduation from Flatiron School’s Online Web Development program, I have been looking at data structures and algorithms in JavaScript. I have noticed that both “for” and “while” loops come up repeatedly (no pun intended) in covering these topics. In this blog post, I intend to take a deeper dive into both the “for” and “while” loops. This will not go into iteration topics like “for.. in” or forEach (perhaps a future blog post?), but will focus on an in-depth examination of two of the most common looping structures available in JavaScript.