gochan-org / gochan

Use for-of loop for array JS-0361
Anti-pattern
Minor
2 months agoa year old
Expected a for-of loop instead of a for loop with this simple iteration
207		return false;
208	}
209	let postID = 0;
210	for(let i = 0; i < checks.length; i++) {211		if(checks[i].id.indexOf("check") === 0) {212			postID = Number.parseInt(checks[i].id.replace("check", ""));213			break;214		}215	}216	window.location.pathname = `${webroot}manage/bans?dir=${boardDir}&postid=${postID}`;
217}
218
Expected a for-of loop instead of a for loop with this simple iteration
79$(() => {
80	let hiddenPosts = getStorageVal("hiddenposts", "").split(",");
81	if(typeof hiddenPosts === "number") hiddenPosts = [hiddenPosts];
82	for(let i = 0; i < hiddenPosts.length; i++) {83		const id = hiddenPosts[i];84		setThreadVisibility(id, false);85		setPostVisibility(id, false);86	}87});