#javascript
Read more stories on Hashnode
Articles with this tag
import { useEffect, useState } from "react"; import "./styles.css"; export default function App() { const [seconds, setSeconds] = useState(60); //...
class Queue { constructor() { this.items = []; this.headIndex = 0; this.tailIndex = 0; } enqueue(element) { ...
class Stack { constructor() { this.items = []; } addToStack(element) { return this.items.push(element) } ...
let arr = [1, 2, 3, 4, 5, 4, 3, 2, 1] let res = 0; for (let i = 0; i < arr.length; i++) { res = res ^ arr[i] } console.log(res)
//Union function union(arr1, arr2) { const arr3 = [ ...new Set([...arr1, ...arr2])] return arr3 } console.log(union(['orange', 'green', 'blue'],...
function removeKthElement(arr, len, removeElem){ let sortedArr = arr.sort((a, b)=> {return a-b}) for(let i=0; i<len ;i++) { if(removeElem ===...