javascript - What is diference? -


this question has answer here:

i begginer in javascript, need theoretical explanation. what's mean ; behind } , why must put there? when work in php don't need put ; after function {} in case.

var orangecost = function(price) {     var quantity = 5;     console.log(quantity * price); }; orangecost(5); 

i want know code or not because can't desired result in case:

var orangecost = function(price) {     var quantity = 5;     console.log(quantity * price); } orangecost(5); 

when assign function variable, it's other assignment.

var amethod = function() { /*...*/ }; var anumber = 123; 

in both cases, semicolons @ end optional. it's recommended add them avoid statements accidentally being combined if newline removed (say, during process of concatenating source code).


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

ios - Possible to get UIButton sizeThatFits to work? -