Skip to content
Advertisement

Tag: function

How does empty return statement in conditional statement functions?

Learning JS from MDN Docs came across code in “functions section”. Not able to understand what does return; in the below code accomplish Output I understood first 5 lines of output, but not able to understand why end: 0,1,2,3 are coming? Please help ! Answer return terminates the current function, and returns control flow to the caller. When foo(3); is

Call JavaScript function from another JavaScript file

In the first.js file, I want to call the functions from second.js: This is second.js file: Answer tl;dr: Load your dependencies before you depend on them. You can’t call a function that hasn’t been loaded. The functions defined in your second JS file won’t be loaded until the first file has finished running all the top-level statements. Reverse the order

Find duplicate values in objects with Javascript

I’ve been trying to work out a problem I’m having. I have an array with objects in it, like this: I want to get the objects that have duplicate values in them and based on what values to search for. I.e , I want to get the object that has a duplicate value “name” and “age” but nog “country” so

Multiply (a)(b) function possible?

I have an oddball of a question from a code quiz. They expect me to write a function that multiplies (a) and (b) but instead of writing it like: They expect me to do the math with: Is it possible ? Answer Make a function that returns another function.

Advertisement