This course is designed as a primer for our JS In-Depth Series of Group Sessions. This is ideal for Design Track students, Developer students struggling to understand JavaScript or students with limited programming experience. We will cover the building blocks of programming with JavaScript. This course assumes little or no experience with JavaScript.First
1. Walk away with a new mental model for learning and understanding JavaScript or any programming language for that matter.
2. Understand what is a variable
3. Understand what the heck is a function
What is a programming Language?
A new mental model for a programming language
What is JavaScript?
JavaScript the Engine aka a Virtual Machine
*Virtual Machine, a fancy word for a piece of Software that can understand a programming language and control a computer hardware functionality
Ecma Script the rules for a JavaScript Runtime / Engine
The V8 JavaSctipt Engine ()
JavaScript the programming language
think of it as English but for Human to Computer communication
we can control the JavaScript Engine / Machine with JS the programming language
*
Let's learn this new language so we can talk to the JavaScript runtime
Your first chat with the JS runtime.
The more we know the language, the more we control the conversation, and what this piece of software called a JavaScript Engine will do in the environment it's running on.
Different JavaScript Environments
When we code, we need to represent, reason and work with data.
So what is data? data type + data value = data in our code;
JavaScript, like most programming languages, give us a predefined set of data types
https://javascript.info/types There are 7 basic types in JavaScript.
The typeof operator allows us to see which type is stored in the variable.
Important Built-In Complex Types
Data types to take up memory? Some data types take up more than others. The JS engine can leverage this info to help us efficiently manage the computer memory our data is using. Also, by having specific types, it allows us to have predefined actions for each type. When we have a particular data type in JavaScript, we know there are particular actions the JavaScript engine knows how to take on this data type.
Example (data tpye | common actions):
toLowerCase()
,includes()
, charAt()
, replace()
isNaN()
, toString()
, toFixed()
indexOf()
, push()
, slice()
, map()
, filter()
, each()
assign()
, create()
, keys()
, values()
, assign()
The last piece we need to create data for our JS Machine to use.
The
var
statement declares a variable, optionally initializing it to a value. Learn More
Teaching our JS Machine new things.
How do we perform custom actions in JavaScript? - we create and call functions
Functions are one of the fundamental building blocks in JavaScript. A function is a JavaScript procedure—a set of statements that performs a task or calculates a value. To use a function, you must define it somewhere in the scope from which you wish to call it. Learn More
[keyword:function][identifier: someName][parameters:()]{
//code goes here
}
function kick(){
console.log("Kick Action")
}
kick
kick();
/* OUTPUT TO CONSOLE
Kick Action
*/