You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.3 KiB
JavaScript

console.log("Hello World");
/*
1. Create the following variables to store to the following user details:
Variable Name - Value Data Type:
firstName - String
lastName - String
age - Number
hobbies - Array
workAddress - Object
The hobbies array should contain at least 3 hobbies as Strings.
The work address object should contain the following key-value pairs:
houseNumber: <value>
street: <value>
city: <value>
state: <value>
Log the values of each variable to follow/mimic the output.
Note: strictly follow the variable names.
*/
//Add your variables and console log for objective 1 here:
// Activity - Part 1
let firstName = 'First Name: John';
let lastName = 'Last Name: Smith';
let age = 30;
let myHobbies = 'Hobbies:'
let hobbies = ['Biking','Mountain Climbing', 'Swimming']
let myWorkaddress = 'Work Address:'
let workAddress = {
houseNumber: 32,
street: 'Washington',
city: 'Lincoln',
state: 'Nebraska'
}
console.log(firstName,'\n',lastName,'\n',age,'\n',myHobbies,'\n',hobbies,'\n',myWorkaddress,'\n',workAddress);
// Activity - Part 2
/*
2. Debugging Practice - Identify and implement the best practices of creating and using variables
by avoiding errors and debugging the following codes:
-Log the values of each variable to follow/mimic the output.
Note: Do not change any variable and function names. All variables and functions to be checked are listed in the exports.
*/
let fullName = "Steve Rogers";
console.log("My full name is: " + fullName);
let currentAge = 40;
console.log("My current age is: " + currentAge);
let friends = ["Tony"," Bruce"," Thor"," Natasha"," Clint"," Nick"];
console.log("My Friends are: ")
console.log(friends);
let profile = {
userName : "captain_america",
fullName : "Steve Rogers",
age: 40,
isActive: false
}
console.log("My Full Profile: ")
console.log(profile);
let fullName2 = "Bucky Barnes";
console.log("My bestfriend is: " + fullName2);
const lastLocation = "Arctic Ocean";
console.log("I was found frozen in: " + lastLocation);
//Do not modify
//For exporting to test.js
//Note: Do not change any variable and function names. All variables and functions to be checked are listed in the exports.
try{
module.exports = {
firstName: typeof firstName !== 'undefined' ? firstName : null,
lastName: typeof lastName !== 'undefined' ? lastName : null,
age: typeof age !== 'undefined' ? age : null,
hobbies: typeof hobbies !== 'undefined' ? hobbies : null,
workAddress: typeof workAddress !== 'undefined' ? workAddress : null,
fullName: typeof fullName !== 'undefined' ? fullName : null,
currentAge: typeof currentAge !== 'undefined' ? currentAge : null,
friends: typeof friends !== 'undefined' ? friends : null,
profile: typeof profile !== 'undefined' ? profile : null,
fullName2: typeof fullName2 !== 'undefined' ? fullName2 : null,
lastLocation: typeof lastLocation !== 'undefined' ? lastLocation : null
}
} catch(err){
}