E6 Javascript
If you use a larger dish than what is recommended
SELECT [Link], [Link], [Link], [Link]
FROM customers AS ct, orders AS ord
WHERE [Link]=ord.Customer_ID
ORDER BY [Link];
<form onsubmit="return validate()" method="post">
Number: <input type="text" name="num1" id="num1" />
<br />
Repeat: <input type="text" name="num2" id="num2" />
<br />
<input type="submit" value="Submit" />
</form>
function validate() {
var n1 = [Link]("num1");
var n2 = [Link]("num2");
if([Link] != "" && [Link] != "") {
if([Link] == [Link]) {
return true;
}
}
alert("The values should be equal and not blank");
return false;
}
function add(x, y) {
var sum = x+y;
[Link](sum);
}
function add(x, y) {
var sum = x+y;
[Link](sum);
}
const add = (x, y) => {
let sum = x + y;
[Link](sum);
}
This new syntax is quite handy when you just need a simple function with one
argument.
You can skip typing function and return, as well as some parentheses and braces.
For example:
const greet = x => "Welcome " + x;
The code above defines a function named greet that has one argument and returns a
message.
If there are no parameters, an empty pair of parentheses should be used, as in
const x = () => alert("Hi");
The syntax is very useful for inline functions. For example, let's say we have an array,
and for each element of the array we need to execute a function. We use
the forEach method of the array to call a function for each element:
var arr = [2, 3, 7, 8];
[Link](function(el) {
[Link](el * 2);
});
However, in ES6, the code above can be rewritten as following:
const arr = [2, 3, 7, 8];
[Link](v => {
[Link](v * 2);
});