function hello () {
console.log("hello World");
}
00001010100110101010011
(defn hello []
(print "Hello World!"))
function hello() {
console.log("Hello world!");
}
http://www.ecma-international.org/ecma-262/6.0/
class Animal {
constructor(type) {
this.type = type;
}
makeSound(sound) {
console.log(sound);
}
}
class Cat extends Animal {
contructor() {
super('cat');
}
makeSound() {
return super.makeSound('meow');
}
}
var cat = new Cat();
cat.makeSound(); // logs 'meow'
function varA() {
var a = 1;
if (true) {
var a = 2;
}
return a;
}
function letA() {
let a = 1;
if (true) {
let a = 2;
}
return a;
}
function constA() {
const a = 1;
if (true) {
const a = 2;
}
return a;
}
function constA() {
const a = 1;
if (true) {
a = 2; // error
}
return a;
}
import {Animal, Cat} from './animals';
import AnimalLogger from 'AnimalLogger';
const logger = new AnimalLogger(Animal);
const catLogger = new AnimalLogger(Cat);
export default logger;
export catLogger;
const object = {
key: 'abba',
song: 'Money money'
}
const {key, song} = object
function getKey({key}) {
return key;
}
getKey(object); // returns 'abba'
const array = [1, 2, 3, 4];
const [first, second, ...rest] = array
var object = {
key: 'abba',
song: 'Money money'
}
var key = object.key;
var song = object.song;
function getKey(object) {
return object.key;
}
getKey(object); // returns 'abba'
var array = [1, 2, 3, 4];
var first = array[0];
var second = array[1];
var rest = array.splice(2);
/* @flow */
function foo(x) {
return x * 10;
}
foo('Hello, world!');
hello.js:5:5,19: string
This type is incompatible with
hello.js:3:10,15: number
var Form = MyFormComponent;
var App = (
<Form>
<Form.Row>
<Form.Label />
<Form.Input />
</Form.Row>
</Form>
);
var Form = MyFormComponent;
var App = React.createElement(
Form,
null,
React.createElement(
Form.Row,
null,
React.createElement(Form.Label, null),
React.createElement(Form.Input, null)
)
);
@Injectable
class BasicView {
constructor() { }
@permission('template')
getTemplate() {
return this.template;
}
}
Dostań pracę w facebooku