Skip to content

js redirect functions of one class to another

I have one class in JS (class1) which receives the class2 in the constructor. Now, what I want to achieve is that I want to be able to call all the functions of class2 on the class1, but I don’t want to write all the function declarations in class1 and then each one of them calling on class2. Is there

javascript add up date and time object in an array

so I have a list of array of time and date I want to join both appointmateDate and appointmentTime to iso format and get a new array of timeRange is that possible🙏🏻 Answer Using setHours. Loop over the array using Array#map and create a new Date object using appointmentDate and then using setHours and appoint…

Node: util.promisify() without callback as final parameter

I’m trying to use util.promisify() to transform a function that uses a callback so I can call it with async/await: https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_promisify_original So far I’ve been able to use it with functions that have the callback as the final parameter, as it…

random equations in javascript

I want my code to create simple equations. You can put in answers and it tells you if you are correct or not. When I run this simple code, input the right answer and click on check, it doesn’t show correct. why is this and how can I fix? Answer In your code, check() requires two arguments rand1 and rand…