Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions basics.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
/* Create a `myName` variable and assign it a String value */

var myName = 'Keyser Soze';

/* Create a `person` variable and give it 2 properties,
* `name`, assign it the same name as before,
* as well as an `age` (number);
*/

var person = {name: 'Keyser Soze', age: 32};

/* Create a variable called `canDrive`,
* if it should be true if your person object is at least 16 years old
*/

var canDrive = true;

function myFunction(){
if (myName >= 16){
return true;
}else{
return false;
}
}

/* Create a function called `greet`,
* it should take a 1 parameter, `name`
* and it should print "Hello, my name is {name}"
*/


function greet(name){
console.log('Hello, my name is ' + name);
}

greet('Ziggy');

/* Create an array called `dataTypes` with atleast 1 of every data type;
* (there are 6 different data types);
*/

var dataTypes = ['Charlie', 11, true, {cat: 'meow', dog: 'woof', bird: 'tweet'}, [12, 15, 32], null, undefined];

/* Create a `dog` object
* it should have a `bark` function that makes your dog bark!
* It should also have a name attribute with the value of 'Spot'
*/

var dog = {
name: 'Spot',
bark: function (){
console.log('Woof!');
}
};



Loading