说明: 一个存储库,用于展示我对JavaScript编程语言的知识,并继续学习该语言。, (A repository for showcasing my knowledge of the JavaScript programming language, and continuing to learn the language.,)
***
![/JavaScript_Logo.png](https://github.com/JavaScript_Logo.png)
# Learning JavaScript
I am not too experienced with the JavaScript programming language at the moment, but I still know a somewhat good amount. This document will go over my knowledge of the JavaScript programming language so far.
This document uses version 1.8 of the JavaScript programming language. The version will NOT be listed with each example.
## Hello world in JavaScript
A simple Hello world program to print out to the web console
```javascript
console.log("Hello WorldWideWeb!");
```
_(i) This example has been tested yet, and works._
## Variables in JavaScript
Variables in JavaScript
```javascript
var x = 2
var y = 16
console.log(2**16);
```
_/!\ This example has not been tested yet, and may not work_
## Break in JavaScript
The break keyword in JavaScript
```javascript
console.log("Break time!");
break;
```
_/!\ This example has not been tested yet, and may not work. I still don't know exactly what the `break` keyword does_
## Functions in JavaScript
Functions in JavaScript
```javascript
function aFunctionalFunction {
console.log("A functional function has finished functioning.");
break;
}
return aFunctionalFunction();
```
_/!\ This example has not been tested yet, and may not work_
## Return in JavaScript
Returning in JavaScript
```javascript
function aFunctionalFunction {
console.log("A functional function has finished functioning.");
break;
}
return aFunctionalFunction();
```
_/!\ This example has not been tested yet, and may not work_
## Alert in JavaScript
The alert command creates an alerting dialogue box.
```javascript
alert("Alert! The alert dialog box is now present");
break;
```
_/!\ This example has not been tested yet, and may not work_
Spamming this function can result in a checkmarkable option to stop displaying popups, as they can get annoying.
```javascript
var x = bool(true)
function alertAlot {
while (x == true) {
alert("I am an alert");
break;
}
}
return alerAlot();
break;
```
_/!\ This example has not been tested yet, and may not work_
## Comments in JavaScript
Comments in JavaScript are identical to comments in C or C++.
```javascript
// This is a single line comment
/* This
is a multiline
comment */
/* Multi-line comments
* can also
* be written
* like this */
```
## For loop in JavaScript
Here is an example of a `for` loop in JavaScript:
```javascript
let x = 0;
for x in range(1,10) {
console.log(x);
}
```
I am not sure if JavaScript supports the `range` keyword in the same way that Python does.
_/!\ This example has not been tested yet, and may not work_
## While loop in JavaScript
Here is an example of a `while` loop in JavaScript
```javascript
let x = -16;
while x > 0 {
console.log(x)
x == x + 1;
}
```
_/!\ This example has not been tested yet, and may not work_
## If statement in JavaScript
Section coming soon
## Drawing in JavaScript
Section coming soon
## Classes in JavaScript
Classes are a feature in JavaScript. The way I know them, they are extremely similar to other languages. At the moment, I don't see much purpose in classes, so I am likely missing something and need to find out what.
```javascript
class superClass {
console.log("Superclass says Hello");
}
```
## OnClick in JavaScript
This example is going to include HTML alongside JavaScript. The 2 languages work strongly together (along with CSS), so this shouldn't be surprising.
Here is the JavaScript portion:
```javascript
function javaScript {
console.log("Object.OnClick activated, alerting message is going to be sent. If you didn't receive the message, you may have disabled dialog boxes for this page.");
alert("Hello HTML, from JavaScript");
}
object.onclick = function(){javaScript};
```
Here is the HTML5 portion:
```html