Unlike ES5, ES6 is not just a modest set of new APIs added to the language. ES6 is a radical jump forward for the language. It includes a lot of new syntactic forms, some of which may take quite a bit of getting used to.
ES6 introduced a new ...
operator that's typically referred to as the spread or rest operator, depending on where/how it's used. Let's take a look.
Rest
parameters collect all the remaining elements into an array which allows us to do really elegant function definitions:
function add(a, b) {
return a + b;
}add(1, 3, 5, 7, 9) //returns…
Once I started learning JavaScript I realized that functions are bread and butter of JavaScript programming language. Alongside classic function declarations there are arrow functions in JS (introduced in ES6). Arrow functions might be confusing in the beginning. In fact, arrow functions are great! They do look nicer, they do take less keystrokes, they are more fun, and they are so handy in React. Let’s take a closer look at their syntax and other differences compare to regular functions.
Instead of the function
keyword, arrow function uses an arrow (=>
) made up of an equal sign and a greater-than character (not to be confused with the greater-than-or-equal operator, which is written >=
). …
In my previous blog I was talking about Active Record magic. I mentioned one useful command but there are quite a few of them so I decided to write about the most frequently used rails commands in this post.
The creator, David Heinemeier Hansson, was making web applications with Ruby and noticed that he was just copy pasting common parts from previous apps into his new work. As a developer, he (and all of us) loved solving hard problems. The only way to get to solving the hard problems that are unique to the domain you are working in is to go up a layer of abstraction. The nitty-gritty of basic web apps should be removed from your head. With Rails, you are able to focus on the hard bits and let the repetitive work melt away. …
Nowadays it’s hard to imagine websites or web applications without having a database. Ruby has such a wonderful tool called Active Record. Active record is the interface that gives you to link the database to your application, it lets you structure your data modules in a logical and nearly plain English way. Active Record is like a bridge between Ruby and Database. First and foremost, in Rails an association is a connection between two (or more) active records models. Let’s dive into it:
Why do we need Associations between models?
They make common operations simpler and easier without having to write tons of code. …