Q:

JavaScript constant behavior?

Noticing this behavior with javascript constants... It looks like the const keyword loses immutability when dealing with objects. 
Would like to know your opinions regarding this behavior?
const fruits = 'banana';
fruit = 'apple';
console.log(fruit); // 'banana'  as expected

//----------------------------------------------------------------------

const fruit = ['apple'];
fruit.push('banana');
console.log(fruit); // ['apple', 'banana'] ???????

fruit = 'anything';
console.log(fruit); // ['apple', 'banana'] as expected;

//----------------------------------------------------------------------

const brands = {};
brands = [];
console.log(brands); // {} as expected

brands.sony = "playstation"
console.log(brands); // {sony:'playstation'} ???????

A:

Javascript constants, as Java constants, are immutable. But you must see them as pointers to values. They will always refer to the same value. That value can be a primitive one or an object. So you cannot change the reference to another object, but you can modify that object (if it is modifiable, primitive types aren't).
const TEST={ name: 'myObject'}
TEST= ... // this always does nothing, the current reference cannot be changed
TEST.name=... //this changes the state of the current reference.

@Jess' answer offers you the way to make an object unmodifiable.

