+ 2
Comparing Lambda with ES6
Does lambda functions in pythons use the same scope as arrow functions in JavaScript? I've been trying to understand this lambda thing but I just can't get it, help please
1 Respuesta
0
Hmm... Thats a cool question, and yes, they both can be used to make functions in short!
Python:
greet = lambda name: print("Hello, "+name)
greet("Va Nessa") # Hello, Va Nessa
JavaScript:
greet = (name) => console.log("Hello, "+name)
greet("Va Nessa") // Hello, Va Nessa
But in JavaScript, you can create bigger functions using it too by using curly brackets like:
greet = (name) => {
console.log("Hello") //first statement
console.log(name) //second statement
}
greet("Va Nessa")



