Skip to content

Instantly share code, notes, and snippets.

@erdemildiz
Last active October 9, 2019 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erdemildiz/64ca912453d7d675909af31fa7b48a33 to your computer and use it in GitHub Desktop.
Save erdemildiz/64ca912453d7d675909af31fa7b48a33 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script type="text/babel">
// Default parameter
const defaultParam = (height) => height = height || 50;
console.log(defaultParam());
// Template Literal
const age = 56;
const template = `Your age: ${age}`;
console.log(template);
// Destructuring Assigment
const destructuringData = { city: 'İstanbul', number: 34 };
const { city, number } = destructuringData;
console.log(city + " : " + number);
// Arrow function
let getYear = () => new Date().getFullYear();
let datas = [{ city: 'istanbul', number: 34 }, { city: 'izmir', number: 35 }];
datas.map((value, index) => console.log(`${index + 1} değeri ${value.city}`));
console.log(getYear());
// Promise
let wait = new Promise((resolve => {
setTimeout(resolve, 2000);
}));
wait
.then(() => console.log("1"));
// Class
class baseModel {
constructor(options = {}, data = []) { // class constructor
this.name = 'Base'
this.url = 'http://azat.co/api'
this.data = data
this.options = options
}
getName() { // class method
console.log(`Class name: ${this.name}`)
}
}
let model = new baseModel();
model.getName();
// Modules export
module.export = {}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment