Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // parameter หลายตัว ////////////////////////////
- let addSync = function (a, b) {
- return a + b;
- }
- let addSync = (a, b) => {return a + b;}
- let addSync = (a, b) => a + b;
- // parameter ตัวเดียว ///////////////////////////
- let powerOfTwo = function(a) {
- return a* a;
- }
- let powerOftwo = a => (
- a * a
- );
- let powerOfTwo = a => a * a;
- // ใช้กับการ loop ใน list ///////////////////////////
- list.forEach(function(item) {
- console.log(item);
- });
- list.forEach(item => console.log(item));
- // return Object ///////////////////////////
- let getEmployee = function () {
- return {
- "id" : 1,
- "name" : "TheUncle"
- };
- }
- let getEmployee = () => ({"id" : 1, "name" : "TheUncle"});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement