A const question

my question is “hard code” vs “run time”

kindly clarify :slight_smile:

i have a quote from a resource, but its from another sites instruction…it may help with context. do not know if i can post that here

Hard code is manually doing things with no configurability.
Runtime is being able to configure things as you go, which can take a bit more development.

A simple example of hard code:

const sum = 2 + 2;

A simple example of runtime is:

const num1 = 2;
const num2 = 2;
const sum = num1 + num2;

That runtime example might be extended to be:

const num1 = prompt("First number to add");
const num2 = prompt("Second number to add");
const sum = num1 + num2;

I prefer runtime.

It depends on what it is, really.

The general statement will be: Hardcoded is something that will never change (hence the ‘hard’ part). Runtime is something that may (or will) change.

A user’s own password? Gotta be runtime, because you dont know who’s using your code before they get there.

The title of your webpage? Unless you’re doing something like a blog or forum or something, the title is going to remain the same. So you hardcode it.

many thanks to you both!