Bug #1: The Inscrutable Code Conundrum

AKA "The Functionality Vacuum"

Reported by: Bob from Accounting

The function in question is supposed to calculate the total cost of all items in the cart. However, it keeps spitting out the square root of the total cost instead.

When trying to calculate the total cost, the function returns: 4.472141212

When the correct total cost is: 20

We are not sure what sorcery is at play here.

Next Bug in Line →

Discuss this bug in the comments

Debug Log:

                    
                        function calculateTotal() {
                            return Math.sqrt(this.totalCost);
                        }
                        var totalCost = 20;
                        console.log(calculateTotal());