-
call and apply
In JavaScript, functions are just objects. This means that you can attach functions to them, just as you can with any other object. Some defaults that come along with being a function are
.toString()
,bind()
,call()
, andapply()
. We’re going to tkae a closer look at two similar, but slightly different methods:call()
andapply()
. -
define_method
There are multiple ways of defining methods in Ruby. The most popular is by using a block, via
def
andend
. One cool thing about Ruby is its metaprogramming (being able to write code that writes code) capabilities. As an example, take a look at thisBaby
class definition. -
box-sizing: border-box
The
box-sizing
property is used to tell the browser how to calculate the width and height of an element. By default, this is set tocontent-box
, which may cause some unexpected behavior for someone new to CSS. -
JavaScript Closures
Contrary to popular belief, a closure is not a function. It is a combination of an inner function and its reference to its lexical environment (scope). They allow access to an outer function from an inner function.
-
Using $apply() and $digest()
Understanding Angular’s
$apply
and$digest
methods require a bit of background on how the browser renders the DOM. The browser has an event loop that will tell it how to display a page.