brunch

Anonymous 함수

#익명함수, #파이썬, #타입스크립트

by 유윤식

파이썬 익명함수


def plus(a, b):

return a+b

print(plus(1, 2))

==> 3


plus = lambda a, b: a+b

print(plus(1, 2))

==> 3


타입스크립트 익명함수


function plus(a, b) {

return a+b

}

console.log(plus(1, 2))

==> 3


let plus = (a, b) => {

return a+b

}

console.log(plus(1, 2))

==> 3


그냥 써보고 싶어서 끄적여봤음...

keyword
작가의 이전글Python API: FastAPI(3)