Hi, I'm Dr. Steve Brule.

Welcome back to Check It Out, the show where we check things out. Today's show is all about JavaSkrip. You gotta know how to put those dang letters together!

Let's Check It Out!

FUNCTIONS

A JavaScript function is a block of code designed to perform a particular task.

A JavaScript function is executed when "something" invokes it (calls it).

A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).

The parentheses may include parameter names separated by commas: (parameter1, parameter2, ...) The code to be executed, by the function, is placed inside curly brackets: {}

Here is an example, dingus!

function name(parameter1, parameter2, parameter3) {
// code to be executed
}


Pretty cool, dangus!

OBJECTS

In real life, a car is an object.

A car has properties like weight and color, as well as different methods like start and stop.

All cars have the same properties, but the property values differ from car to car. All cars have the same methods, but the methods are performed at different times.

An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's value can be a function, in which case the property is known as a method. In addition to objects that are predefined in the browser, you can define your own objects.

Here is an example of an Object, dingus!

let person = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};


If you wanna know about JavaSkrip, you have to know about the Arrays. If you wanna know about the Arrays you has to listen to me right now!!

ARRAYS

An array is a special variable, which can hold multiple values at a time.

If you have a list of items (a list of all your dang friends, for example), storing them each in single variables could get messy!

What if you want to loop through your dang friends and find a specific doofus? And what if you had 300 dang, doofus friends?

The solution is an array!

An array can hold many values under a single variable, and you can access the values by referring to an index number.

Index numbers start at 0 for the first value and count up depending on the number of values in the array.

Here is an example, dingus!

let cars = [
"Saab",
"Volvo",
"BMW"
];


Now you're a dang JavaSkrip Coder!
Good job, dingus!
But you're not as good as me, so get better!