I was doing some reading about JavaScript and came across something called "use strict";. That's not what this question's about, it's simply an example of placing a string in code. What interested me was that I can place a string (or indeed, any other value) on its own line of code in JavaScript and it does absolutely nothing (from what I can tell). For example, as far as I'm aware, the following code has no purpose:
(function(){
    "random string";
    8;
    true;
    [1,2,3];
    { "key": "value" }
}())
Why can I do this and what purpose does it serve?
I also realised that functions that return a value effectively do this (am I correct?):
// Some code...
function doSomething() {
    // Do some stuff
    return true;
}
doSomething();
// Some more code...
Does that effectively evaluate to this?
// Some code...
function doSomething() {
    // Do some stuff
    return true;
}
true;
// Some more code...
 
     
    