Skip to content

Tag: javascript

I want to connect react and firebase

I have problem with Firebase and React. This problem is after click to my add-data button for adding data to database. I get this console.log Reference_impl.ts:482 Uncaught TypeError: db._checkNotDeleted is not a function at ref (Reference_impl.ts:482:1) at insertData (Modal.js:44:1) at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1) at invokeGuardedCallback (react-dom.development.js:4277:1) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1) at executeDispatch (react-dom.development.js:9041:1) at processDispatchQueueItemsInOrder (react-dom.development.js:9073:1) at processDispatchQueue (react-dom.development.js:9086:1)

Object Literal instead of switch

I would like to use object literal instead of switch statement, but i got this error: Element implicitly has an ‘any’ type because expression of type ‘string’ can’t be used to index type ‘{ apple: string[]; orange: string[]; watermelon: string[]; default: void; }’. No index signature with a parameter of type ‘string’ was found on type ‘{ apple: string[]; orange:

How to get textContent including childNodes?

I have some plain text content in paragraphs inside a <main> HTML element. the paragraphs are separated by new lines (n), not in <p> tags, and I would like to automatically wrap them in <p> tags using JavaScript. Example content: Inside of <main> there may be <img> elements. I want the script to watch for these and leave them untouched.

How do I write a JavaScript program for the question given below

Write a function that takes three (str, c, n) arguments. Start with the end of ‘str’. Insert character c after every n characters? I think, I am using wrong method. Answer Start with the end of ‘str’. Insert character c after every n characters? I assumed this means the string needs to end with c after the change. Correct me

Modifying attributes and texts that follow simple patterns

Here is my initial unuseful code. I would like that the browser works with the following code for the body where [[ … ]] has been cut, and {{ SOMETHING }} is become <span style = “color: red;; font-weight: bold;”>SOMETHING</span>. I have no control on the DOM structure, and the places where [[ … ]] and {{ … }} are

Generate random letters “H” and “V” n times

I have a really specific problem and can’t think of an answer. I have a function to generate a letter H or V. I want to make that if the generator exceedes the limit for H to pick V and if the limit for V gets exceeded to pick H. Example Limit for H is 10 Limit for V is

why do these similiar functions not work?

I have some divs and if i hover them I want an popup to show. I have six divs and six popups to show but not all at once instead only one per one. The first function works fine but then the other do not work how can I move them all to one snippet? Answer okay so actually i

THREE.js collision detection and stop/move again

I have a rounded ground and there is a ball on it. trying to move the ball inside the ground with using smartphone orientation. no problem with that part. the ball is moving and make the ball stop at the edge by using three.js intersectsSphere. but couldn’t manage the move the ball again if the orientation points opposite direction. here