Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basicsbranchkp #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
31 changes: 30 additions & 1 deletion basics.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
/* Create a `myName` variable and assign it a String value */

var myName = "krishna";
/* 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:"krishna",
age: 23

};

/* Create a variable called `canDrive`,
* if it should be true if your person object is at least 16 years old
*/
var canDrive;
if (person.age < 16){
canDrive = false;
}
else
canDrive = true;


/* Create a function called `greet`,
* it should take a 1 parameter, `name`
* and it should print "Hello, my name is {name}"
*/
var greet = function (name){
console.log("Hello, my name is " + name);

}
greet("krishna");

/* Create an array called `dataTypes` with atleast 1 of every data type;
* (there are 6 different data types);
*/
var dataTypes = ['chocolate', 4, false, 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 bark () { console.log("Bark!!");}


};