menu

JavaScript Functions

JavaScript Functions - Important Points


6. What is the syntax to declare a JavaScript function?

A. function myFunction() {}

B. let myFunction = function() {}

C. myFunction = function() {}

D. let myFunction() {}

Discuss Work Space

Answer: option a

Explanation:

The syntax to declare a JavaScript function is using the keyword "function" followed by the function name and parentheses, and then the function code enclosed in curly braces.

7. Which keyword is used to return a value from a JavaScript function?

A. return

B. break

C. continue

D. yield

Discuss Work Space

Answer: option a

Explanation:

The "return" keyword is used to return a value from a JavaScript function.

8. Which of the following is not a valid JavaScript function parameter passing method?

A. Pass by value

B. Pass by reference

C. Pass by pointer

D. Pass by object

Discuss Work Space

Answer: option c

Explanation:

JavaScript does not have the concept of pointers, so "Pass by pointer" is not a valid parameter passing method.

9. What is the purpose of the "arguments" object in a JavaScript function?

A. To store the function name

B. To store the function code

C. To store the function parameters

D. To store the function return value

Discuss Work Space

Answer: option c

Explanation:

The "arguments" object is an array-like object that stores the function arguments passed to a JavaScript function.

10. Which of the following is a built-in JavaScript function?

A. prompt()

B. alert()

C. console.log()

D. All of the above

Discuss Work Space

Answer: option d

Explanation:

prompt(), alert(), and console.log() are all built-in JavaScript functions.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now