Photo by Malkarium on Unsplash

let

let cat = 'Mufasa';// Between the curly brace is the block scopefunction catName() { // Start of the block scope
console.log("catName:", cat);
}; // End of the block scope
function catRenamed() {
let cat = 'Scar'; // You can re-declare variables with the keyword let in different scopes
console.log("catRenamed:", cat);
}
catName();
catRenamed();
console.log(cat); // What does this log out?

Photo by Free-Photos from Pixabay

Basic For Loop Syntax

for (index; condition; increment/decrement) {
// body of the loop
}
for (let i = 0; i < 5; i++) {…

Photo by Tyler Nix on Unsplash

Basic Syntax of Filter

const newArray = array.filter(item => {
return condition;
});

Using filter()

const prices = [10, 20, 30, 40, 50, 60, 70];const newPrices = prices.filter((price) => {
return price > 40;
});
console.log(prices) // [10, 20…


Photo by Brooke Lark on Unsplash

How should you style your code?

The Zen of Python, by Tim PetersBeautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that…


Photo by Joshua Hoehne on Unsplash

What is a Dictionary?


Image by congerdesign from Pixabay

Slicing a List

names = ["michael", "dwight", "jim", "kevin", "andy"]
print(names[0:2])
>>> ['michael', 'dwight']


Image by Arek Socha from Pixabay

What is an If Statement?

name = "jill"if name == "jill":
print("Hey Jill")
elif name == "john":
print("Hello John")
else:
print("Wait a minute, who are you?")
>>> Hey Jill
for number in range(1, 101):
if number == 7:
print(str(number) + " is my favorite number!")
elif number == 50:
print(str(number) + " is half of 100!") …


Image by Jose Antonio Alba from Pixabay

Tuples

names = ("frank", "john")
print(names[0])
print(names[1])
>>> frank>>> john
names = ("frank", "john")
print(names[0])
print(names[1])
names[0] = "will">>> frank>>> johnTraceback (most recent call last):
File…


Photo by Andrew Buchanan on Unsplash

Using the range() Function

for i in range(0, 3):
print(i)
>>> 0>>> 1>>> 2


Photo by Tine Ivanič on Unsplash

Looping through a List

friends = ["kyle", "paul", "chris"]
print(friends[0])
print(friends[1])
print(friends[2])
>>> kyle>>> paul>>> chris
friends…

Aldrin Caalim

Learning is neat.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store