Skip to content

Tag: function

Can a some() function replace nested forEach()?

I need to replace two (nested) forEach loops with a some function. The purpose of the code block is to check if the [1] elements in arrayOne are within the max & min of arrayTwo. The code currently works fine and looks like this: Let me know if it isn’t clear enough. Really appreciate your help. Ans…

Why is my decryption function not working?

I created a function to encrypt and decrypt messages. the encrypting works fine. but when I try to log encrypted Hello World! it just logs H. Fixed it, i edited the encoding system to place a – between chars and the decoding system to just split the message at – and check if the element starts wit…

Set variable to method

I want to make a shorthand library for myself, ex: shortening querySelector to get. would there be a way to return just the method without document? EXAMPLE: Thanks. Answer You have to call .querySelector on either the document or an element. It can’t be left off. While you could pass it into the functi…