>devroast
//component_library
//typography

paste your code. get roasted.

//detailed_analysis

description text sample

lang: javascript · 7 lines

function calculateTotal()

//buttons
//toggle
roast mode
roast mode
//badge_status
criticalwarninggoodneeds_serious_help
//cards
critical

using var instead of const/let

the var keyword is function-scoped rather than block-scoped, which can lead to unexpected behavior and bugs. modern javascript uses const for immutable bindings and let for mutable ones.

//code_block
calculate.js
1
2
3
4
5
6
function calculateTotal(items) {
var total = 0;
for (var i = 0; i < items.length; i++) {
total = total + items[i].price;
}
}
//diff_line
-var total = 0;
+const total = 0;
for (let i = 0; i < items.length; i++) {
//table_row
#12.1function calculateTotal(items) { var total = 0; ...javascript
//navbar
>devroast
leaderboard
//score_ring
3.5/10