Computer Science, asked by SadeemShowkat, 5 months ago

4. Tania wants to store her name in a variable. What type of variable she needs?
please answer right answer ​

Answers

Answered by Arshiyassiddiqui
4

Explanation:

All variable names must begin with a letter of the alphabet or an. underscore( _ ). ... After the first initial letter, variable names can also contain letters and numbers. ... Uppercase characters are distinct from lowercase characters. ... You cannot use a C++ keyword (reserved word) as a variable name

Answered by Anonymous
10

Answer:

A variable is a “named storage” for data. We can use variables to store goodies, visitors, and other data.

To create a variable in JavaScript, use the let keyword.

The statement below creates (in other words: declares) a variable with the name “message”:

let message;

Now, we can put some data into it by using the assignment operator =:

let message;

message = 'Hello'; // store the string

The string is now saved into the memory area associated with the variable. We can access it using the variable name:

let message;

message = 'Hello!';

alert(message); // shows the variable content

To be concise, we can combine the variable declaration and assignment into a single line:

let message = 'Hello!'; // define the variable and assign the value

alert(message); // Hello!

We can also declare multiple variables in one line:

let user = 'John', age = 25, message = 'Hello';

That might seem shorter, but we don’t recommend it. For the sake of better readability, please use a single line per variable.

The multiline variant is a bit longer, but easier to read:

let user = 'John';

let age = 25;

let message = 'Hello';

Some people also define multiple variables in this multiline style:

let user = 'John',

age = 25,

message = 'Hello';

…Or even in the “comma-first” style:

let user = 'John'

, age = 25

, message = 'Hello';

Technically, all these variants do the same thing. So, it’s a matter of personal taste and aesthetics.

var instead of let

In older scripts, you may also find another keyword: var instead of let:

var message = 'Hello';

The var keyword is almost the same as let. It also declares a variable, but in a slightly different, “old-school” way.

There are subtle differences between let and var, but they do not matter for us yet. We’ll cover them in detail in the chapter The old "var".

Explanation:

plzz mark as brainleist

Similar questions