JavaScript Basics
In this week's track, you'll be writing code to pass tests that we've written.
Learning objectives
To be able to answer "yes" to the following questions:
- Are you confident working with different data types and structures in Javascript?
- Can you write functions to encapsulate a piece of logic?
- Can you write a test that describes the expected behaviour of a function?
In addition, you'll also get more practice using the skills you gained during the pre-course.
Concepts
- Primitive data types - booleans, numbers, strings
- Data structures - arrays, objects
- Functions
- Operators
- Control-flow
Challenge
This week's challenge uses the JavaScript Basics repository on GitHub. Fork the repository and clone it to your machine using git clone
. Once done, change directories so that you are within the javascript-basics
folder.
:bulb:
Take a look in the package.json file at the top level of the cloned javascript-basics
repository. In this file you have dependencies
and devDependencies
. These are external packages (bundles of code other people have written) that we can bring into our own projects so we don't need to re-invent the wheel.
The npm install
command (you can do npm i
for short) will tell npm (node package manager) to download the dependencies
and devDependencies
for this project. It will place them inside a node_modules
folder in your javascript-basics
directory.
Have a quick look in that folder - you might notice there are many more packages that weren't listed in the package.json. That's because the packages we want to install each have other packages they depend on to work properly - most developers use code written by other developers to aid them in their development.
Recommended Reading
Below are a couple of bytes that we recommend you read in order to help you in approaching the challenges in this exercise. Think of bytes like like our course encyclopedia. They cover concepts in more detail than in lectures - you should always read them as they pop up in the learning material, or make time to read them at home.