COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
JAVASCRIPT | GETTING STARTED
 ON THIS PAGE
​SECTION 1 | ABOUT JAVASCRIPT
​SECTION 2 | ABOUT THIS COURSE
​SECTION 3 | HELLO WORLD
SECTION 4 | ALERT AND CONSOLE LOG

ALSO IN THIS TOPIC
YOU ARE HERE | GETTING STARTED
​VARIABLES & USER INPUT
 OPERATORS

CONDITIONALS (IF STATEMENTS)
​ITERATION (LOOPS)
ARRAYS (LISTS)
FUNCTIONS

FURTHER JAVASCRIPT

Picture
SECTION 1 | ABOUT JAVASCRIPT
JavaScript is known as the most popular programming language and is often abbreviated to JS. It is a nice language to learn, used by many major tech companies, can lead to get job opportunities. JavaScript is predominantly used to create the web behaviour of websites and is supported by all major web browsers.

​In this course, before we delve into applying JavaScript to build web pages, we will first cover six fundamental topics. 
​

1 | Variables and User Input
2 | Operators
3 | Selection structures (IF Statements)
4 | Iteration (Loops)
5 | Arrays (Lists)
6 | Functions

Mastering these fundamental topics provides a solid foundation for understanding the core mechanics and logic of JavaScript. By grasping these essentials, you can effectively tackle more complex tasks and challenges in web development. These basics serve as the building blocks upon which all advanced JavaScript functionalities and features are built. Without a clear understanding of these fundamentals, diving into more intricate aspects of JavaScript can become overwhelming and confusing. 

After covering these fundamentals we move on to look at JavaScript in Web Development.
SECTION 2 | ABOUT THIS COURSE
To get started with coding in JavaScript we recommend using Visual Studio Code, downloading nodejs and Live server.
  • Visual Studio Code is where you will write your code. LINK TO DOWNLOAD
  • Nodejs will help with the ability to install and use 3rd party libraries. LINK TO DOWNLOAD (Use LTS version) 
  • Live Server will help quick viewing of your project as you are developing. (VSC extension by: Ritwick Day)

You will write your code in Visual Studio Code and you will view your program in your Web Browser, we further explain this later.
SECTION 3 | HELLO WORLD
Welcome, budding developer! As you embark on your journey into the world of JavaScript it's essential to start with the basics. The following instructions will guide you through creating your very first JavaScript program using Visual Studio Code (VSC). By the end of this guide, you'll have set up your coding environment, written a simple program, and seen it in action. This foundational exercise, often termed the "Hello World" program, is a rite of passage for many developers and serves as a stepping stone to more complex coding adventures. Let's dive in!

STEP 1 | On your desktop, create a new folder and name it "JavaScript_Files" or a similar descriptive name.
STEP 2 | Launch Visual Studio Code. From the top menu, select File > Open Folder and choose the folder you just created on your desktop.
STEP 3 | To create a new JavaScript file:
Click on the Explorer icon (it looks like two stacked documents) on the top left.
Click on the "New File" icon (it looks like a sheet of paper with a plus sign).
STEP 4 | Name your file with a descriptive name, ensuring you add the .js extension at the end. For example: learnVariables.js.
STEP 5 | Inside your new JavaScript file, write the following code to output 'Hello World':

    
STEP 6 | To run your program -
A | In VSC's top menu, click on Run.
B | Choose 'Run Without Debugging' (or press Ctrl + F5).
C | When prompted, select Node.js as the environment/debugger.
D | Your code should now execute, and "Hello World" will be displayed in the VSC terminal.
SECTION 4 | ALERT AND CONSOLE LOG
Both alert and console.log are used to display information, but they serve different purposes and are used in different contexts. 

alert
  • Purpose: Primarily used to display messages directly to the user.
  • Display: Shows a popup dialog box in the browser.
  • Interactivity: Interrupts the user's flow because they have to click "OK" to close the dialog.
  • Use Cases: Useful for simple notifications, warnings, or error messages to the user.

console.log
  • Purpose: Primarily used for debugging and development purposes.
  • Display: Outputs information to the browser's console (not visible to users unless they open the developer tools).
  • Interactivity: Non-intrusive; doesn't interrupt the user's interaction with the webpage.
  • Use Cases: Useful for developers to log information, errors, objects, or track code execution.

alert is for directly communicating with the user, especially when you want their immediate attention.
console.log is for developers to inspect, debug, and track information during development or troubleshooting.
For a beginner learning JavaScript, using alert can be a straightforward way to see the output of their code. However, as you progress, you will likely use console.log more frequently for its detailed and non-intrusive logging capabilities. To get you started use console.log in Visual Studio Code and when we move on to IF statements we will start tot use alert.
Picture
NAVIGATION
GETTING STARTED
​VARIABLES & USER INPUT
 OPERATORS
CONDITIONALS (IF STATEMENTS)
 ​ITERATION (LOOPS)
ARRAYS (LISTS)
FUNCTIONS

FURTHER JAVASCRIPT
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.