AAlter the behavior of console.log
so that it will print not only the given values but also their types.
Example:
console.log(3); // 3 "number"
console.log("a"); // "a" "string"
console.log(2, "a"); // 2 "number" "a" "string"
Implement getUniqueSortedNumbers(tree)
function. It should return an array of unique number
values in given tree
object, sorted in ascending order.
The type of the tree
argument would be defined in TypeScript as:
type Tree = Record<string, number | Tree>;
Example:
getUniqueSortedNumbers({
a: {
x: 3,
y: {
d: 2,
e: 2,
f: {
g: 4
},
z: 8
}
}
}); // [2, 3, 4, 8];
My answers are incorrect? 🤔
cc: @digitalbase @OskarGasiorowski