Pure Js Code Performance
by Roland Doda
JavaScript
const custom_fields = [
{ id: 1, text: "not widen", value: "something" },
{ id: 2, text: "Widen Portal URL", value: "something" },
{ id: 3, text: "not widen", value: "something" }
]
console.time('function #1')
function should_show() {
let should_show_icon = false
for (let custom_field of custom_fields) {
if (custom_field.text === 'Widen Portal URL') {
should_show_icon = true
break
}
}
return should_show_icon
}
should_show()
console.timeEnd('function #1')