Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9bbc234
Console Log and Alerts Hello World
reginaalyssa Mar 10, 2019
d52dd9f
Update sidebar content
reginaalyssa Mar 10, 2019
12c125a
Comment out reference to Web Applications section
reginaalyssa Jun 21, 2020
26ac6bf
Update sidebar
reginaalyssa Jun 21, 2020
8ec3abc
Update code blocks in Hello World
reginaalyssa Jun 21, 2020
5fff5eb
Add Data Types & Operators, populate content on Numbers
reginaalyssa Jun 21, 2020
fe66498
Fix link on data types & operators
reginaalyssa Jun 21, 2020
eea5164
Include section on variables and undefined data type
reginaalyssa Jun 22, 2020
8b27dcc
Add content on Null data type
reginaalyssa Jun 22, 2020
8e07227
Update contents of data types section to include Boolean and Logical …
reginaalyssa Jun 22, 2020
82b3775
Add section on numbers data type
reginaalyssa Jun 25, 2020
27fa0db
Update comment on usage of semicolons and remove extra spaces
reginaalyssa Jun 25, 2020
39603d2
Update sidebar
reginaalyssa Jun 26, 2020
db09fa9
Update folder structure for web and JS basics
reginaalyssa Jun 26, 2020
6616272
Update reference to page
reginaalyssa Jun 26, 2020
03f3e98
Rename Exercise section
reginaalyssa Jun 26, 2020
3138371
Update to be added message
reginaalyssa Jun 26, 2020
ed04aa8
Remove unused files
reginaalyssa Jun 26, 2020
5b86dcb
Update Intro to Data Types and Variables
reginaalyssa Jun 26, 2020
3633d50
Separate data types and operators sections
reginaalyssa Jun 26, 2020
5275d74
Update headings for primitives
reginaalyssa Jun 26, 2020
f8096a5
Remove extra file for data types
reginaalyssa Jun 26, 2020
f833e60
Add Wrap Up for Primitive Values and section on Symbols
reginaalyssa Jun 26, 2020
1d1f1f6
Add content on BigInt
reginaalyssa Jun 26, 2020
df02d39
Update link
reginaalyssa Jun 26, 2020
9ea91f2
Update image references and add section on Strings
reginaalyssa Jun 26, 2020
af54a35
Add notes on Objects and Functions
reginaalyssa Jun 26, 2020
2930a29
Add image example for string replacement
reginaalyssa Jun 26, 2020
3a066eb
Merge branch 'master' into docs/js-language
reginaalyssa Jun 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added _media/arithmetic-operators.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/browser-console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/browser-inspect-element.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/console-alert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/console-log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/logical-operators.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/string-replacement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _media/variable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 16 additions & 10 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
- [About Us](wwcodemanila/about.md)
- [Study Groups](wwcodemanila/study_groups.md)

- Introduction
- [JavaScript Study Group](README.md)
- Web Fundamental Concepts
- [HTML, CSS, JavaScript: How They Work Together](contents/web/html_css_js.md)
- [A Recap of HTML and CSS](contents/web/html_css_recap.md)

- Basic Concepts
- [How to Read This Guide](contents/starter_pack_guide.md)
- Web Fundamentals
- [HTML, CSS, JavaScript: How They Work Together](contents/html_css_js.md)
- [A Recap of HTML and CSS](contents/html_css_recap.md)
- Introduction to JavaScript
- [Language Features](contents/js_language_features.md)
- [Examples From the Web](contents/js_examples_from_the_web.md)
- JavaScript Basics
- ["Hello, World!" Your First JS Code](contents/basics/hello_world.md)
- [JavaScript Code Structure](contents/basics/js_structure.md)

- Data Types
- [Intro to Data Types and Variables](contents/data_types/overview_and_variables.md)
- [Data Types: Primitive Values](contents/data_types/primitives.md)
- [Data Types: Objects](contents/data_types/objects.md)

- Operators
- [Logical Operators](contents/operators/logical.md)
- [Arithmetic Operators](contents/operators/arithmetic.md)
- [Comparison Operators](contents/operators/comparison.md)

- Resources
- [References](resources/references.md)
70 changes: 70 additions & 0 deletions contents/basics/hello_world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## Overview

For this tutorial, we will walk you through on the fundamentals of JavaScript as a language. We'll focus on building on your knowledge of the core concepts of JavaScript.

## Hello, World!

We begin learning JavaScript with the best-selling introduction to programming: **"Hello, World!"**. This is usually the first ever exercise when learning a new programming language. This exercise simply lets you output the words "Hello, World!" in the language you're learning.

Mentioned earlier in [HTML, CSS, JavaScript: How They Work Together](contents/web/html_css_js.md) is how JavaScript mostly deals with bringing interaction to our websites. As such, it seems fit that we use a web browser to run our first line of JS code.

### Console

Begin by opening your preferred web browser. In the screenshot guides, we used Google Chrome.

Right click on anywhere in your web browser and select the option to "Inspect" or "Inspect Element".

![](../../_media/browser-inspect-element.png "Google Chrome - Inspect")

This will open the Inspector where you can see details about the web page you're currently viewing. Open the tab "Console".

![](../../_media/browser-console.png "Google Chrome - Console")

Then, write your JS code by entering the following line to the console:

```
console.log("Hello, World!");
```

which should output something similar to what's shown below:

![](../../_media/console-log.png "Console Log - Hello, World!")

Now, let's look into what just happened. You just instructed your browser to print "Hello, World!" by placing this text inside the parenthesis for the function `console.log`. As its name suggests, it logs to the console whatever you want it to.

### Alert

Printing to the console is cool but normal visitors of a website won't really go to the trouble of checking "Inspect Element" to see what you logged in the console. However, you may have encountered an alert before.

An alert is the pop up window that shows up on the top of your browser. The common reasons why this appears is to either

1. warn you that what you're doing is not allowed or
2. confirm if you're sure you want to proceed with a certain action.

To try this out, enter the following in the console:

```
alert("Hello, World!);
```

![](../../_media/console-alert.png "Alert - Hello, World!")

## Exercises

1. Try to see what happens when you change the text "Hello, World!".

```
console.log("I can print anything here!");

alert("This is a function call.");
```

2. What happens if you remove the quotation marks?

3. Try printing numbers too! Did it work?

## Wrap Up

You just learned two different ways of printing "Hello, World!". `console.log` will come in handy later when debugging while `alert` can be used to show warnings to users of your site.

More importantly though, you made a function call which we'll be learning more about later on. For now, it's a good observation to note that whatever we passed inside the parenthesis will be used by the function.
1 change: 1 addition & 0 deletions contents/basics/js_structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This page is still empty. We're still working on it!
1 change: 1 addition & 0 deletions contents/data_types/objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This page is still empty, but it will cover Objects and Functions. Stay tuned!
45 changes: 45 additions & 0 deletions contents/data_types/overview_and_variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Overview

In this section, we will give an overview of what data types are as well as a brief introduction to variables in JavaScript.

## Data Types

All values declared in JavaScript can be classified under a certain data type.

Data types show us what kind of values we can use in our code as well as what kind of operations we can do on those values. They tell us the classifications and behavior of the different kinds of values that we can represent in our program.

In JavaScript, almost all of the data types are **immutable**. This means they **cannot be modified or changed**. These kinds of data types are called **primitive values** or simply **primitives**. The exception to this are **objects (and functions)**, which can be modified.

> As of writing this document, there are **9 data types** in defined in the ECMAScript standard.

## Variables

Before we learn about the different data types, let's take a look first into the concept of variables.

A variable, like in Math, is used to represent something in our code. What is "something"? It could be any of the data types (which we'll learn more about later on).

One common way to think about variables would be perhaps a box that you own and put values in. The usual way of declaring variables is using `let` followed by the name you want to call your variable. If you would like to assign a value to a variable, you use the `=` equals sign followed by the value you want to save to the variable you just declared.

![](../../_media/variable.png "Variable Declaration")

> Notice that there's a semicolon at the end of our variable declaration. We usually place semicolons (;) at the end of every line in JavaScript (except for code blocks). Although this isn't required and some developers choose to omit it from their code since JavaScript "assumes" where to place it if it's missing, we'll be consistently using semicolons for our examples.

### Variable Names

In general, there are two rules when it comes to naming your variables.

1. You can only use a combination of letters (`a-z`, `A-Z`), numbers (`0-9`), and the symbols `$` and `_` for your variable name.
2. You cannot have a number as the first character of your variable name.

Also, multi-word variable names are usually written in `camelCase` where the next words begin with a capital letter, but you may come across some code that uses the `snake_case` where words are separated by the underscore symbol.

> When declaring variable names, we usually try to be as descriptive as possible to make our code readable.

### Exercises

Test out different variable names to check whether they are valid variable names or not.

1. Try doing `let 1apple;` on the console and see what happens. Did it show an error?
2. Try out declaring a variable using your name `let <your first name here>;`. For example, in my case, I did `let reg;`. Did it show an error?
3. Declare a variable using your first name and last name separated by a hyphen (`-`).
4. Declare a variable using your first name and last name separated by an underscore (`_`).
Loading