Perimeters with a Catch // Edabit

PHOTO EMBED

Tue Dec 26 2023 09:24:36 GMT+0000 (Coordinated Universal Time)

Saved by @msagr

function perimeter(l, num){
	let dict = new Object();
	dict = {
		's' : 4*num,
		'c' : 2*num*3.14,
	};
	return dict[l] || undefined;
}
content_copyCOPY

Note :- Nice implementation to perform different calculations without using if-else statement.

https://edabit.com/challenges/javascript