EDITS MADE: based on people's suggestions below, I made the following edits to my code.
The code is returning undefined. And nothing is getting console logged out. What am I doing wrong?
function test(arr, initialValue) {
      let reverseStr; 
      if (initialValue === {}) {
        reverseStr = {};
      } else {
        reverseStr = '';
      }
      console.log(reverseStr)
    }
    test(['a', 'b', 'c', 'd'], {})
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I have the following code below:
function test(arr, initialValue) {
  console.log(initialValue)
  if (initialValue === {}) {
    let reverseStr = {};
  } else {
    let reverseStr = '';
  }
  console.log(reverseStr)
}
test(['a', 'b', 'c', 'd'], {})I am expecting the invoked function to console log {}.  Instead, I get ReferenceError: reverseStr is not defined 
What am I doing wrong?
