好吧……我想我最好在這個問題上尋求一些幫助:
const name = “alain”;
const arr = ["[email protected]", "[email protected]", "[email protected]", "[email protected]"];
我想做的就是:搜索以 開頭的電子郵件地址“alain”并將該電子郵件地址作為變數回傳給我,我可以在其他函式中使用它。
知道如何實作嗎?
謝謝:)
uj5u.com熱心網友回復:
const address = arr.find(element => element.startsWith(name))
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/406030.html
標籤:
上一篇:自定義Tkinter影像
