Search Header Logo

Understanding JavaScript Functions and Parameters

Authored by Rita Vasak

Computers

10th Grade

Used 7+ times

Understanding JavaScript Functions and Parameters
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for declaring a function named `myFunction` in JavaScript?

`function myFunction() {}`

`declare myFunction() {}`

`def myFunction() {}`

`create myFunction() {}`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a function expression in JavaScript?

`function myFunc() {}`

`var myFunc = function() {}`

`function: myFunc() {}`

`myFunc function() {}`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the term for the values passed to a function when it is called?

Parameters

Arguments

Variables

Constants

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the following function, what is the parameter? ```javascript function greet(name) { return "Hello, " + name; } ```

greet

name

"Hello, "

return

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following function return? ```javascript function add(a, b) { return a + b; } ```

The sum of `a` and `b`

The product of `a` and `b`

`a` minus `b`

`b` minus `a`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code:

```javascript

var x = 10;

function example() {

var x = 20;

println(x); }

example(); ```

What will be printed to the screen?

10

20

30

undefined

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you ensure a function returns a value in JavaScript?

By using the `return` keyword followed by the value

By using the `output` keyword followed by the value

By using the `send` keyword followed by the value

By using the `give` keyword followed by the value

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?