Length Constraint
EasyType the function so it accepts only values with a length field.
const getLength = (data) => {
return data.length
}TypeScript•UTF-8
Run your code to see results.
Click the Run button above
Length Constraint
EasyType the function so it accepts only values with a length field.
const getLength = (data) => {
return data.length
}Examples:
Input 1: getLength([1, 2, 3])
Output 1: 3
Input 2: getLength({ length: 777 })
Output 2: 777
Output
Run your code to see results.