photo by Tine Ivanič on unsplash
If you cannot explain what you are attempting to accomplish to a sixyear-old child, then you are probably not clear about it yourself. -Albert Einstein
前言
Javascript裡的for迴圈家族,不外乎就是for、forEach、for...in以及for...of,這幾個兄弟了,而今天我們要針對for...in和for...of做深入的介紹。
for in迴圈基本介紹
for in這個語法是在ES5就已經出現的語法,而他可以針對物件(Object)以及陣列(Array)做遍歷,來看看以下的程式碼範例。