Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help with questions 1 to 6, it's JavaScript. please provide a code for each question that I can run, and be able

Can you please help with questions 1 to 6, it's JavaScript. please provide a code for each question that I can run, and be able to check the difference from the code in the questions. I am new to this language,so please thorough explanation will be greatly appreciated

image text in transcribed

image text in transcribed

1. I want this code to log out "hey amy", but it logs out "hey arnold" - why? function greet (person) { if (person == { name: 'amy' }) { return 'hey amy' } else { return 'hey arnold' } greet ({ name: 'amy' }) 2. I want this code to log out the numbers 0, 1, 2, 3 in that order, but it doesn't do what I expect for (var i = 0; i console.log(i), 0) 3. I want this code to log out "doggo", but it logs out undefined! let dog = { name: 'doggo', sayName() { console.log(this.name) } let sayName dog.sayName sayName() 4. I want my dog to bark(), but instead I get an error. Why? function Dog (name) { this.name = name Dog.bark = function () { console.log(this.name + I says woof') let fido = new Dog ('fido') fido.bark() 5. Why does this code return the results that it does? function is Big (thing) { if (thing == 0 || thing return false == 1 || thing 2) { } return true } isBig (1) isBig ([ 2] ) isBig ([ 3] ). 1 false // false 1 true 6. Write a function to check if an input contains a substring in the following format. Please make use of regular expressions in this task. Sample input: (see bold text for substring to identify) domain.com/items/jyw73982/fentum-accumsan-1452261075-9781452261072 | result = true domain.com/items/der0932/ker-fooba-1461075-971072-123124124 / result = false domain.com/items/kdm3891/sem-mollis-fringilla-678123478691234-2345567 | result = true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago