Question

In: Computer Science

function exerciseOne(){ // Exercise One: In this exercise you will create a variable called 'aboutMe' //...

function exerciseOne(){
// Exercise One: In this exercise you will create a variable called 'aboutMe'
// This variable should be assigned a new object
// In this object create three key:value pairs
// The keys should be: 'name', 'city', 'favoriteAnimal'
// The values should be strings associated with the keys.
// return the variable 'aboutMe'

}

function exerciseTwo(animal){
// Exercise Two: In this exercise you will be given an object called 'animal'
// Create a new variable called 'animalName'
// Accessing the animal object, assign the 'animalName' variable to the 'latinName' key on the object.
// return the animalName variable.
}

function exerciseThree(userObject){
// Exercise Three: In this exercise you will be given an object called 'userObject'
// The phonne number for this user is incorrect!
// reassign the 'phoneNumber' key to the value: '(951)867-5309'
// return the userObject
}

Solutions

Expert Solution

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Below is the function implementation.

//funcion exerciseOne

function exerciseOne() {

// Exercise One: In this exercise you will create a variable called 'aboutMe'

// This variable should be assigned a new object

// In this object create three key:value pairs

// The keys should be: 'name', 'city', 'favoriteAnimal'

// The values should be strings associated with the keys.

// return the variable 'aboutMe'

var aboutMe = new Object({ "name": "Virat", "city": "Delhi", "favoriteAnimal": "dog" });

return aboutMe;//return object

}

//function exerciseTwo

function exerciseTwo(animal) {

// Exercise Two: In this exercise you will be given an object called 'animal'

// Create a new variable called 'animalName'

// Accessing the animal object, assign the 'animalName' variable to the 'latinName' key on the object.

// return the animalName variable.

var animalName = animal.latinName;

return animalName;

}

//function exerciseThree

function exerciseThree(userObject) {

// Exercise Three: In this exercise you will be given an object called 'userObject'

// The phonne number for this user is incorrect!

// reassign the 'phoneNumber' key to the value: '(951)867-5309'

// return the userObject

userObject.phoneNumber = "(951)867-5309";

return userObject;

}

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.


Related Solutions

Complete exercise 9.20 from the text. (a) Create a function called polygon that draws a polygon...
Complete exercise 9.20 from the text. (a) Create a function called polygon that draws a polygon in a polar plot. Your function should have a single input parameter – the number of sides. (b) Use a for loop to create a figure with four subplots…You should use the function you created in part (a) to draw each polygon. Use the index parameter from the for loop to specify the subplot in which each polygon is drawn, and in an expression...
Creates a function called pick. The function receives a "string" representing one year (the variable with...
Creates a function called pick. The function receives a "string" representing one year (the variable with this "string" will be called uve) and a list containing "strings" representing bank accounts (call this bera list). <br> • Each account is represented by 8 characters. The format of each account number is "**-**-**", where asterisks are replaced by numeric characters. o For example, "59-04-23". • The two central characters of the "string" for each account represent the year the account was created....
In Python Create a function called ℎ?????. The function has as arguments a list called ??????...
In Python Create a function called ℎ?????. The function has as arguments a list called ?????? and a list call center. • List ?????? contains lists that represent points. o For example, if ?????? = [[4,2], [3,2], [6,1]], the list [4,2] represents the point with coordinate ? at 4 and y coordinate at 2, and so on for the other lists. Assume that all lists within points contain two numbers (that is, they have x, y coordinates). • List ??????...
(EXCEL) Create a user-defined function called Hexagon that takes one argument called side and returns the...
(EXCEL) Create a user-defined function called Hexagon that takes one argument called side and returns the area of a regular hexagon given the length of the side. Show that the function works in a worksheet by inserting the formula somewhere.
#Write a function called get_integer that takes as input one #variable, my_var. If my_var can be...
#Write a function called get_integer that takes as input one #variable, my_var. If my_var can be converted to an integer, #do so and return that integer. If my_var cannot be converted #to an integer, return a message that says, "Cannot convert!" # #For example, for "5" as the value of my_var, get_integer would #return the integer 5. If the value of my_var is the string #"Boggle.", then get_integer would return a string with the #value "Cannot convert!" # #Do not...
In Python Create a function called ????. The function receives a "string" that represents a year...
In Python Create a function called ????. The function receives a "string" that represents a year (the variable with this "String" will be called uve) and a list containing "strings" representing bank accounts (call this list ????). • Each account is represented by 8 characters. The format of each account number is "** - ** - **", where the asterisks are replaced by numeric characters. o For example, “59-04-23”. • The two central characters of the "string" of each account...
in phyton programming: with numpy Create a function called biochild.  The function has as parameters...
in phyton programming: with numpy Create a function called biochild.  The function has as parameters the number m and the lists ??????h?? and ??????h??.  The lists ??????h?? and ??????h?? contain 0’s and 1’s.  For example: ??????h?? = [1,0,0,1,0,1] and ??????h?? = [1,1,1,0,0,1]  Both lists have the same length ?.  The 0's and 1's represent bits of information (remember that a bit is 0 or 1).  The function has to generate a new list (child)....
IN PYTHON Create a function called biochild.  The function has as parameters the number m...
IN PYTHON Create a function called biochild.  The function has as parameters the number m and the lists biomother and biofather.  The biomother and biofather lists contain 0’s and 1’s.  For example: biomother = [1,0,0,1,0,1] and biofather = [1,1,1,0,0,1]  Both lists have the same length n.  The 0's and 1's represent bits of information (remember that a bit is 0 or 1).  The function has to generate a new list (child).  The child...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following: Creates a directory called CyberSecurity-Notes in the current working directory Within the CyberSecurity-Notes directory, creates 24 sub-directories (sub-folders), called Week 1, Week 2, Week 3, and so on until up through Week 24 Within each week directory, create 3 sub-directories, called Day 1, Day 2, and Day 3 Bonus Challenge: Add a conditional statement to abort the script if...
THANK YOU FOR ANSWERING THE 4 QUESTIONS Q3. Create a function in Python called sum_list_div2 which...
THANK YOU FOR ANSWERING THE 4 QUESTIONS Q3. Create a function in Python called sum_list_div2 which takes as input a list of integers and returns the sum of the elements of the list which divide by 2. Examples of tests in the Python interpreter: >>> sum_list_div2 ([1,4,3,8,5]) 12 >>> sum_list_div2 ([]) 0 >>> sum_list_div2 ([4, -10,7]) -6 -------------------------------------------------------------------------------------------------------------------------------------------------------------- Q5. Imagine a customer at a bank who must enter a number that represents their money. There are people who type spaces...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT