+ 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

14th Nov 2025, 2:27 AM
Va Nessa
Va Nessa - avatar
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")
14th Nov 2025, 3:30 AM
ᴜɴᴋɴᴏᴡɴ ᴅᴇᴄᴏᴅᴇʀ
ᴜɴᴋɴᴏᴡɴ ᴅᴇᴄᴏᴅᴇʀ - avatar