You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
// Declare and assign string data type
|
|
const name = 'Gideon';
|
|
|
|
// Declare and assign boolean data type
|
|
const isStudent = true;
|
|
|
|
// Declare a variable without assignment (undefined)
|
|
//let age;
|
|
|
|
// Declare and assign null data type
|
|
const favoriteColor = null;
|
|
|
|
// Declaring four variables without assigning values
|
|
let gideon
|
|
let asabeneh
|
|
let gitHub
|
|
let nike
|
|
|
|
// Declaring four variables with assigned values
|
|
let randomName = 'Eren';
|
|
let year = 2023;
|
|
let month = 'August';
|
|
let favoriteFruit = 'apple';
|
|
|
|
// Declaring variables in multiple lines
|
|
/* const firstName = 'Gideon';
|
|
const lastName = 'Buba';
|
|
let isMarried = True;
|
|
let country = 'Nigeria';
|
|
const age = 21; */
|
|
|
|
// Declaring varibles in a signle line
|
|
let firstName = 'Gideon', lastName = 'Buba', isMarried = true, age = 21;
|
|
|
|
//variables to log to browser console
|
|
myAge = 21;
|
|
yourAge = 30;
|
|
|
|
console.log('I am', myAge , 'years old');
|
|
console.log('I am', yourAge, 'years old');
|
|
|
|
|
|
|
|
// Print the variables to the console
|
|
console.log('Name:', name);
|
|
console.log('Is Student:', isStudent);
|
|
console.log('Age:', age);
|
|
console.log('Favorite Color:', favoriteColor);
|