When you touch Javascript you need understand what is _ [ Arrow function ] .
let you written and learing Code of Difficult will be reduce a lot on Framwork
let your all program look like simply .
e.g : Use arrow function const yes = ( )=>{ console.log ( b ) }() => b ;or
function barry ( x ) { return x +1 } //function
const barry = (x ) => { return x +1 } //arrow function
both same !!
箭頭函數帶入參數值:
Two paramas in set , need use “ ( ) “
For example . before Node.js seting express function :
const server = http.createserver ( ( req , res ) => {
statuscode = 200
res.setHeader(‘ content-Type ‘,‘text/html ‘ ) //設定回應內容的類型res.end ( ` create your node server ` ) //設定回應的內容})( req , res ) => { } // 設定好的兩個參數 req 和 res 在函數內可以使用()=> 匿名函數 Anonymous. const barry = () => 非匿名函數 no anonymouse
simply example :
const add = ( a , b ) =>{ a + b ; console.log. ( add ( 5 , 3 ) } > 8