Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Please complete the details below this message

# Your Details

- Your Name:
- Your City:
- Your Slack Name:
- Your Name: Jude Ricketts
- Your City: Ldn 8
- Your Slack Name: Loves Pictures

# Homework Details

- Module:
- Week:
- Module: JS1
- Week: 1

# Notes

- What did you find easy?
- What did you find easy? -

- What did you find hard?

Expand Down
28 changes: 15 additions & 13 deletions exercises/A-setup-ide/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
There are some tools that will help you to write code. One of these, [Prettier](https://prettier.io/), formats your code, making it easier for you and others to read.

### 1. Install prettier

- In Visual Studio open the extensions panel (see https://code.visualstudio.com/docs/editor/extension-gallery#_browse-and-install-extensions)
- Search for `Prettier - Code formatter`
- Click install on the top result

### 2. Enable formatting on save

- In Visual Studio open the settings file (see https://code.visualstudio.com/docs/getstarted/settings#_creating-user-and-workspace-settings)
- Search for `editor format`
- Set `editor.formatOnSave` and `editor.formatOnPaste` to true
There are some tools that will help you to write code. One of these, [Prettier](https://prettier.io/), formats your code, making it easier for you and others to read.

### 1. Install prettier

- In Visual Studio open the extensions panel (see https://code.visualstudio.com/docs/editor/extension-gallery#_browse-and-install-extensions)
- Search for `Prettier - Code formatter`
- Click install on the top result

### 2. Enable formatting on save

- In Visual Studio open the settings file (see https://code.visualstudio.com/docs/getstarted/settings#_creating-user-and-workspace-settings)
- Search for `editor format`
- Set `editor.formatOnSave` - Did this

and `editor.formatOnPaste` to true - Would not load this - to be revisited
36 changes: 18 additions & 18 deletions exercises/B-hello-world/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
It is programming tradition that the first thing you do in any language is make it output 'Hello world!'.

We'll do this in JavaScript, using something called `console.log()`.

Inside of `exercise.js` there's a line of code that will print "Hello world!".

### 1. Run the program

- Open a terminal window
- Change directory to this folder (`cd exercises/B-hello-world`) - assuming you're at the project root
- Run the program using node (`node exercise.js`)

### 2. Experiment

- Try to `console.log()` something different. For example, 'Hello World. I just started learning JavaScript!'.
- Try to console.log() several things at once.
- What happens when you get rid of the quote marks?
- What happens when you console.log() just a number without quotes?
It is programming tradition that the first thing you do in any language is make it output 'Hello world!'.
We'll do this in JavaScript, using something called `console.log()`.
Inside of `exercise.js` there's a line of code that will print "Hello world!".
### 1. Run the program
- Open a terminal window
- Change directory to this folder (`cd exercises/B-hello-world`) - assuming you're at the project root
- Run the program using node (`node exercise.js`)
### 2. Experiment
- Try to `console.log()` something different. For example, 'Hello World. I just started learning JavaScript!'.
- Try to console.log() several things at once.
- What happens when you get rid of the quote marks?
- What happens when you console.log() just a number without quotes?
3 changes: 2 additions & 1 deletion exercises/B-hello-world/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
console.log("Hello world");
console.log("Hello world");
console.log("My name is Jude" + " hello world :) ");
52 changes: 26 additions & 26 deletions exercises/C-variables/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
When you write code, you'll want to create shortcuts to data values so you can don't have to write out the same value every time.

We can use _variable_ to create a reference to a value.

```js
var greeting = "Hello world";

console.log(greeting);
```

The program above will print "Hello world" to the console. Notice how it uses the value assigned to the variable `greeting`.

## Exercise

- Add a variable `greeting` to exercise.js (make sure it comes _before_ the console.log)
- Print your `greeting` to the console 3 times

> Remember: to run this exercise you must change directory to the `C-variables`. If you already have a terminal window open for the previous exercise you can do this by running the command `cd ../C-variables`.

## Expected result

```
Hello world
Hello world
Hello world
```
When you write code, you'll want to create shortcuts to data values so you can don't have to write out the same value every time.
We can use _variable_ to create a reference to a value.
```js
var greeting = "Hello world";
console.log(greeting);
```
The program above will print "Hello world" to the console. Notice how it uses the value assigned to the variable `greeting`.
## Exercise
- Add a variable `greeting` to exercise.js (make sure it comes _before_ the console.log)
- Print your `greeting` to the console 3 times
> Remember: to run this exercise you must change directory to the `C-variables`. If you already have a terminal window open for the previous exercise you can do this by running the command `cd ../C-variables`.
## Expected result
```
Hello world
Hello world
Hello world
```
8 changes: 5 additions & 3 deletions exercises/C-variables/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Start by creating a variable `greeting`

console.log(greeting);
// Start by creating a variable `greeting`
var greeting = "Hello World";
console.log(greeting);
console.log(greeting);
console.log(greeting);
58 changes: 29 additions & 29 deletions exercises/D-strings/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
In programming there are different _types of_ data. You've used one data type already: **string**.

Computers recognise strings as a sequence of characters but to humans, strings are simply lines of text.

```js
var message = "This is a string";
```

Notice that strings are always wrapped **inside of quote marks**. We do this so that the computer knows when the string starts and ends.

You can check that the data is a string by using the `typeof` operator:

```js
var message = "This is a string";
var messageType = typeof message;

console.log(messageType); // logs 'string'
```

## Exercise

- Write a program that logs a message and its type

## Expected result

```
This is a string
string
```
In programming there are different _types of_ data. You've used one data type already: **string**.
Computers recognise strings as a sequence of characters but to humans, strings are simply lines of text.
```js
var message = "This is a string";
```
Notice that strings are always wrapped **inside of quote marks**. We do this so that the computer knows when the string starts and ends.
You can check that the data is a string by using the `typeof` operator:
```js
var message = "This is a string";
var messageType = typeof message;
console.log(messageType); // logs 'string'
```
## Exercise
- Write a program that logs a message and its type
## Expected result
```
This is a string
string
```
8 changes: 5 additions & 3 deletions exercises/D-strings/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Start by creating a variable `message`

console.log(message);
// Start by creating a variable `message`

x = "This is a string";
console.log(x);
console.log(typeof x);
40 changes: 20 additions & 20 deletions exercises/E-strings-concatenation/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
You can add two strings together using the plus operator (`+`):

```js
var greetingStart = "Hello, my name is ";
var name = "Daniel";

var greeting = greetingStart + name;

console.log(greeting); // Logs "Hello, my name is Daniel"
```

## Exercise

- Write a program that logs a message with a greeting and your name

## Expected result

```
Hello, my name is Daniel
```
You can add two strings together using the plus operator (`+`):
```js
var greetingStart = "Hello, my name is ";
var name = "Daniel";
var greeting = greetingStart + name;
console.log(greeting); // Logs "Hello, my name is Daniel"
```
## Exercise
- Write a program that logs a message with a greeting and your name
## Expected result
```
Hello, my name is Daniel
```
11 changes: 8 additions & 3 deletions exercises/E-strings-concatenation/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Start by creating a variable `message`

console.log(message);
// Start by creating a variable `message`

var greetingStart = "Hello, my name is ";
var myName = "Jude";

var greeting = greetingStart + myName;

console.log(greeting);
80 changes: 40 additions & 40 deletions exercises/F-strings-methods/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
You can find out how many characters there are in a string by using the `length` property of a string:

```js
var name = "Daniel";
var nameLength = name.length;

console.log(nameLength); // Logs 6
```

You can also get a modified version of a string by calling _string methods_. Let's try one:

```js
var name = "Daniel";
var nameLowerCase = name.toLowerCase();

console.log(nameLowerCase); // "daniel"
```

You can find out more about string properties and methods by searching for "JavaScript string methods".

## Exercise 1

- Log a message that includes the length of your name

## Expected result

```
My name is Daniel and my name is 6 characters long
```

## Exercise 2

- Log the same message using the variable, `name` provided
- Use the `.trim` method to remove the extra whitespace

## Expected result

```
My name is Daniel and my name is 6 characters long
```
You can find out how many characters there are in a string by using the `length` property of a string:
```js
var name = "Daniel";
var nameLength = name.length;
console.log(nameLength); // Logs 6
```
You can also get a modified version of a string by calling _string methods_. Let's try one:
```js
var name = "Daniel";
var nameLowerCase = name.toLowerCase();
console.log(nameLowerCase); // "daniel"
```
You can find out more about string properties and methods by searching for "JavaScript string methods".
## Exercise 1
- Log a message that includes the length of your name
## Expected result
```
My name is Daniel and my name is 6 characters long
```
## Exercise 2
- Log the same message using the variable, `name` provided
- Use the `.trim` method to remove the extra whitespace
## Expected result
```
My name is Daniel and my name is 6 characters long
```
31 changes: 28 additions & 3 deletions exercises/F-strings-methods/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
// Start by creating a variable `message`

console.log(message);
// Start by creating a variable `message`

// exercise 1
var myName = "Jude";
var nameLength = myName.length;
console.log(nameLength); // Logs 4

// exercise 2 a
var myName = ` JUDE RICKETTS `;
var nameLowerCase = myName.toLowerCase();
console.log(nameLowerCase.trim()); // "jude ricketts"

// exercise 2 b
let text = " Jude Ricketts ";
let result = text.replace(/^\s+|\s+$/gm, "");
console.log(result);

// exercise 3
// this needs to use a similar stucture to; console.log(str1.concat(' ', str2));
var myName = "Jude ";
var nameLength = myName.length;
var myChars = " characters long";

console.log(
"My name is " + myName + "and my name is " + nameLength + myChars + "."
);

// str.trim()
Loading