如果我的問題措辭有誤,我會提前道歉,但我有這個問題。
const restaurant = {
name: 'Ichiran Ramen',
address: `${Math.floor(Math.random() * 100) 1} Johnson Ave`,
city: 'Brooklyn',
state: 'NY',
zipcode: '11206',
}
我應該創建一個包含地址、城市、州和郵編的新變數,但我不知道該怎么做。
到目前為止,我已經嘗試過:
const fullAddress = address.city.state.zip
但我得到一個錯誤,說我沒有定義完整的地址變數。我真的不知道接下來要做什么,我現在已經重新觀看了大約 5 次視頻,我完全迷失了。任何幫助將非常感激。
uj5u.com熱心網友回復:
你的意思是: const fullAddress = `${restaurant.address}, ${restaurant.city}, ${restaurant.state}, ${restaurant.zipcode}` 嗎?請注意,它不會在物件和構建的字串之間創建系結。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/453037.html
標籤:javascript 目的
上一篇:從v-if中選擇多個按鈕
