Ole Ersoy

--

--

Image by Jevgeni Fil from Pixabay

Scenario

We have the code console.log("Hola!") .

Is this an expression or a statement?

Approach

An expression returns a value. The statement console.log("Hola!") does not return a value so it is not an expression.

The below code illustrates an expression.

const greeting = spanish ? "Hola!" : "Hi!";

If spanish is true greeting is assigned Hola! otherwise Hi! is assigned.

The expression part of the statement is spanish ? “Hola!” : “Hi!” .

Demo

--

--

Image by Ulrike Leone from Pixabay

Scenario

We have a header within a flex container that we want to expand as space allows and also to have a minimum width of 200px.

<div style="display: flex">
<div id="header">this is the header</div>
</div>

Approach

Style the header div with flex: 1 0 200px; , which means flex-grow: 1 and so…

--

--