One question for some reason I can't figure out how to do it. I have 2 objects and need to use optional operator to get value in typescript. I can break them into 2 line but I am wondering how can I do in one line code?
// in python
car = {
"brand": "Ford",
}
name = {
"brand": "Ford",
}
x, y = car.get("price", 150), name.get('print', 200)
print(x, y)
// Something like this?
const {price: carPrice = 150, price: namePrice =200} = {car?.price, name?.price}
//It works but I would like to be one line code
const carPrice = car?.price || 150
const namePrice = name?.price || 200