Reputation: 1328
So, lets imagine we have next functions structure:
1)
const foo = (value) => { // imperative code writing
return value ? 1 : 0
}
2)
const bar = (value) => { // declarative code writing
const boo = value ? 1 : 0
return boo
}
Can someone tell me is there is some performance, style or logic difference btw using such two styles of code writing in JavaScript? Or maybe one of them is really better for using?
Thanks!
Upvotes: 0
Views: 58
Reputation: 4712
That'll be optimized out in the engine you're running the JavaScript in.
Even if it wasn't the performance hit will be so incredibly small that it's not worth worrying about.
Upvotes: 3