Hirdetés
-
PROHARDVER!
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
Jim-Y
veterán
Például ha Reactos projekte van az embernek, és használ JSX-et és reactify-al buildeli, akkor ezeket a harmony feature-öket használhatja:
reactify transform also can compile a limited set of es6 syntax constructs into es5. Supported features are arrow functions, rest params, templates, object short notation and classes. You can activate this via --es6 or --harmony boolean option:
Mozillában tesztelve, próbáldd ki őket, scratchpadben mindegyik megy
arrow functions
============document.body.addEventListener('click', event => console.log(event.target));
rest params
=========function sum(a, b, ...rest) {
return Math.max(...[a,b].concat(rest));
}
console.log(sum(1,2)); // 2
console.log(sum(1,2,4,1,5,6,12,2,3)); // 12templates
========console.log(
`The max out of 1 and 2 is ${sum(1,2)}`
);
// "The max out of 1 and 2 is 2"object shorthand notation
===================var myModule = function() {
var newMax = function(a, b, ...rest) {
return Math.max(...[a,b].concat(rest));
};
var oldMax = function() {
return Math.max.apply(Math.max, [].slice.call(arguments));
};
// old syntax
// return {
// oldMax: oldMax,
// newMax: newMax
// };
return {
oldMax,
newMax
};
};
console.log(
myModule().oldMax(1,2,3,4,9,3,4,5)
); // 9classes
======// In iojs/node
class Topic extends EventEmitter {
constructor() {
super();
}
publish() {
this.emit('article');
}
subscribe(subscriber) {
// subscribe
}
}És nincs felsorolva, de a destructuring is műküdik:
destructuring
==========var React = require('react'),
{ Route, DefaultRoute } = require('react-router'),
{ AppComponent, Contact, Content } = require('./components/Screens'),
baseUrl = require('../appConfig.json').app.baseUrl;
module.exports = (
<Route name="home" path={baseUrl} handler={AppComponent}>
<Route name="contact" path="contact" handler={Contact} />
<DefaultRoute handler={Content} />
</Route>
);
Új hozzászólás Aktív témák
- NVIDIA GeForce RTX 4080 /4080S / 4090 (AD103 / 102)
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
- Kerékpárosok, bringások ide!
- Milyen légkondit a lakásba?
- Horgász topik
- Meggyi001: Nyilvános wc-k.....még mindig hiánypótló...
- OLED TV topic
- Mozilla Firefox
- Béta iOS-t használók topikja
- Butcher82: Retro - műanyag fehérítés
- További aktív témák...
- Pc rx7600 xt 16gb
- Eladó Konfig I5-10400F 32GB DDR4 1TB SSD RTX2060 Super 8GB!
- Meta Quest 3 (128GB) VR szemüveg megannyi kiegészítővel - szinte új állapotban, garanciális
- Eladó GAMER konfig! I5-12400F 512GB SSD 1TB HDD 32GB DDR4 RTX3060 12GB!
- iPhone 12 Pro / 128GB / Pacific Blue / Gyári kártyafüggetlen (233)
- GYÖNYÖRŰ iPhone 13 mini 128GB Starlight -1 ÉV GARANCIA - Kártyafüggetlen, MS3133, 95% Akkumulátor
- HIBÁTLAN iPhone 13 Pro 256GB Silver -1 ÉV GARANCIA - Kártyafüggetlen, MS3019, 100% Akkumulátor
- Telefon felvásárlás!! Honor 200 Lite, Honor 200, Honor 200 Pro, Honor 200 Smart
- GYÖNYÖRŰ iPhone 13 Pro 256GB Graphite -1 ÉV GARANCIA - Kártyafüggetlen, MS3074, 100% Akkumulátor
- 122 - Lenovo Legion Pro 5 (16ARX8) - AMD Ryzen 7 7745HX, RTX 4070 - 4 év garancia
Állásajánlatok
Cég: FOTC
Város: Budapest