Commits (2)
# Scope in JavaScript, vars, lets and consts
The latest version of Javascript was published in 2015 and is called ES6 or ECMAScript 6. It it important that we use the most up to date features in the language for our modern Progressive Web Apps to function well.
### references:
* https://hashnode.com/post/scope-in-javascript
* https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/
* https://www.w3schools.com/Js/js_variables.asp
Javascript variables can be declared in three different ways:
* var
* let
* const
The latter two have only been available in the latest versions of Javascript and they got created because ultimately, var is considered to be too flexible. Example below:
```
var greeter = "hey hi";
var times = 4;
if (times > 3) {
var greeter = "say Hello instead";
}
console.log(greeter) // "say Hello instead"
```
> So, since times > 3 returns true, greeter is redefined to "say Hello instead". While this is not a problem if you knowingly want greeter to be redefined, it becomes a problem when you do not realize that a variable greeter has already been defined before.
> If you have used greeter in other parts of your code, you might be surprised at the output you might get. This will likely cause a lot of bugs in your code. This is why let and const are necessary.
console.log("hello from script");
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>UI Programming 21 22</title>
<link rel="stylesheet" href="assets/css/screen.css">
<script type="text/javascript" src="assets/js/script.js"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
# Canvas transformations + audio content