Week 2 - Programming basics

JavaScript

Basic Syntax

Variables

Data types

Numbers

Basic IO

Conditionals

Nested conditions

Git branches

GUI Tools for Git

Code style: Basics

Introduction to AI

Practice

Assignment

Back to core program

Content

Let’s get practical

Exercise 1

Write a simple JS application that prompts the user for his age and prints to the console:

Exercise 2

Write a simple JS application that prompts the user for two numbers (number1, number2) and prints different math calculations: addition, subtraction, multiplication, division and modulus

Exercise 3

Rewrite the following code to switch case syntax:

const monthNumber = 3; // 1-12
let monthName;

if (monthNumber === 1) {
  monthName = "January";
} else if (monthNumber === 2) {
  monthName = "February";
} else if (monthNumber === 3) {
  monthName = "March";
} else if (monthNumber === 4) {
  monthName = "April";
} else if (monthNumber === 5) {
  monthName = "May";
} else if (monthNumber === 6) {
  monthName = "June";
} else if (monthNumber === 7) {
  monthName = "July";
} else if (monthNumber === 8) {
  monthName = "August";
} else if (monthNumber === 9) {
  monthName = "September";
} else if (monthNumber === 10) {
  monthName = "October";
} else if (monthNumber === 11) {
  monthName = "November";
} else if (monthNumber === 12) {
  monthName = "December";
} else {
  monthName = "Invalid month number";
}

console.log(monthName);

Exercise 4 - Git branching game

This fun game teaches you how Git branches and merges work

https://learngitbranching.js.org/

Exercise 5 - Compare chatbots

Create a new account with one of the services you haven't used yet: Claude, Gemini, Grok, ChatGPT, or Perplexity. Try to use the chatbot for the day, how do you compare it to the one you got used to? think about the response quality, length, speed and the website UI.

Exercise 6 - Personalise ChatGPT

To get the most out of ChatGPT, use the personalisation features in your settings:

Experiment with different instruction styles to find what works best for your learning style and workflow!


The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 **

CC BY-NC-SA 4.0 Icons

*https://hackyourfuture.net/*