Functional programming | suggestions needed

I was solving one of the problem on the site and came across a very bizarre incident.
Here, is the IDE already written function is as

// The global variable
var fixedValue = 4;

function incrementer () {
  // Only change code below this line
  // Only change code above this line

Problem Statement : Fill in the code for the function incrementer so it returns the value of the global variable fixedValue increased by one.

I wrote a solution which is wrong and compiled correctly which it should not
My answer :

var fixedValue = 4;
function incrementer () {
  return ++fixedValue

Now if i do console.log(fixedValue) outside the function scope it will output 5 and this answer is accepted by the system. Why?

uh, that doesn’t seem right
but, still, please, include the challenge link when you talk about a challenge

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.