Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LukeSkyRunner/4b76166be09da85d9f0f25fb0b8a1c16 to your computer and use it in GitHub Desktop.
Save LukeSkyRunner/4b76166be09da85d9f0f25fb0b8a1c16 to your computer and use it in GitHub Desktop.
Javascript Functions and Datatypes - Recap Practice
//Define a function getCredentials() that will receive the following object as argument and print the following result:
let user = {
username: "ironhacker",
password: "123iron345"
}
console.log (`Username is: ${user.username} and the password is: ${user.password}.`)
//Define a function checkProperty() that will use the following object passed as an argument to print the output in the console:
let property = {
owner: {
firstName: "John",
lastName: "Doe",
age: 44
},
isForSale: true,
sqrm: 120,
address: {
street: "Happy St",
number: 123,
city: "Miami",
state: "FL",
country: "US"
},
amenities: ["pool", "tennis court", "private parking", "yard"]
}
function checkProperty(object){
if (property.isForSale = true){
console.log (property);
} else {
console.log (`The home in ${property.address, property.street} is not for sale.`);
}
}
checkProperty(property);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment