please help with that i am not sure what is happening im using the following: but it is only the joi that im having issues with Answer Try schema.validate instead of Joi.validate Reference: https://joi.dev/api#example
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
How to toggle different colors on consecutive clicks (on SVG objects)
I’m trying to let all elements in group change to specific colors on different amount of clicks. One click = red, two clicks = blue, etc. It needs to toggle all children in the group. JavaScript SVG file I want all the elements in the SVG group to change colors on the first click to red, second click to green,
how to get radio and option button value then push to array while being able to call it
I have this program that involves entering your information and after clicking submit the information is then pushed to an array and send to console… the user can then search such as last name and if it has a match then it will show the other information that came with it after submit e.g. age,sex,birthdate,address etc.. What I’m trying to
Using already created functions inside a new Javascript function
I’m beginner, so this question might be silly. I had to do 4 Javascript Function, I will put them below Now i have to create the last function, which does: Applies Half function on the parameter I’ve given to the new function(a), stores is in a new variable(result), result becomes parameter for the function square, the result will be stored
Is there a way to make this code shorter? (reaction collector)
I tried to make one filter for both collectors but still have to type this (x,y,z) => filter(x,y,z,’⏪’) Answer You can make a higher-order function, one that takes in the character you’re looking for and returns a function that takes three arguments (reaction, user, and c, corresponding to your current (x, y, x) =>) and returns the appropriate filter operation.
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.
Canonical way to run an array of functions in Javascript/Node
I have found two handy modules called run-parallel and run-series to run arrays functions and return arrays of results. Looking at the little number of contributors and stars in the Github projects, I wonder if there is a canonical way of doing these tasks instead of installing these modules? Maybe there is a native way in Node or in ES6