Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

As JavaScript student, I want to Define and invoke an anonymous function which takes a number and returns its square. If input is 2, output

As JavaScript student, I want to Define and invoke an anonymous function which takes a number and returns its square. If input is 2, output should be 4. 

 

2.  As JavaScript student, I want to Define an IIFE function which takes a personName as input and displays a greeting message containing the personName. If input is "Harry", output should be "Hello Harry, Welcome to Paradise!" 

 

3. As JavaScript  student, I want to Define a global array variable containing 3 numbers. Define a function which increments the value of each of the elements of this array by 2. Display the array after you have invoked this function. 

 

4. As JavaScript  student  to  create  a "course" object having following information - courseName as "Computer Science", durationInMonths as 24, level as "Beginner". Display object information. Change the value of level as "Intermediate". Display object information again. 

 

5. As JavaScript  student ,  Given an array, "students" of JSON objects write a code to iterate through each of these codes and extract the first name and last name of each student. 

 

6. As JavaScript  student , Given a function doubleNumber which takes a number as an argument and returns its double value. I want to Write a function which takes 2 arguments- 1st an array of numbers and 2nd the doubleNumber function as a callback function This function should iterate through each of the array numbers and use the doubleNumber function to double it. In the end it should display the updated array.

 

 7.  As JavaScript student, I want  to Implement a function called `multiplyBy` that multiplies a number by a specific factor using an IIFE (Immediately Invoked Function Expression).

 

 8. As JavaScript  student,  I want to  Using the `call` method, write a function that finds the maximum number in an array.

 9. As JavaScript  student,  I want to Declare an object named "car" with an empty object as its initial value. Add the properties "make" and "model" with values "Toyota" and "Camry" respectively.

 

10 As JavaScript  student,  Given an array "students" of JSON objects define a function displayByKey which takes this array object and a keyName as string and displays the value of the key for each of the JSON objects.

 

 

 Task B

  1. As JavaScript  student,  Define 2 functions - 1st function named as checkEven which will check if the number passed is even or not. 2nd function named filterEvens which will take an array of numbers and the checkEven function as arguments. This filterEvens function will filter out only even numbers using the checkEven function and generate a new array of the even numbers.

 

 2   As JavaScript  student,  Write an IIFE that calculates the factorial of a given number and immediately logs the result to the console.

 

 3. As JavaScript  student,  Implement a function calculate that takes three arguments: a, b, and an operation function. The operation function should accept two parameters and perform a specific mathematical operation like addition, subtraction, multiplication, and division. Use call (), apply(), or bind() to apply the operation function to the arguments a and b.

 

 4. As JavaScript  student, Given an array of person objects, define a function to find the oldest person object.

 

 5. As JavaScript  student, I want to Create a function that calculates the sum of an array using IIFE function.

Step by Step Solution

3.46 Rating (149 Votes )

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions