What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-26 08:29:02
how array sort works internally in javascript
let arr = [90, 1, 20, 14, 3, 55]; var sortRes = []; var copy = arr.slice(); //create duplicate array var inc = 0; //inc meant increment copy.sort((a, b) => { sortRes[inc] = [ a, b, a-b ]; inc += 1; return a - b; }); var p = 0; for (var i = 0; i <... Add solution -
TypeScript 2021-09-25 17:16:02
testing inputs with react testing library
import React from 'react' import { render, fireEvent } from '@testing-library/react' class CostInput extends React.Component { state = { value: '', } removeDollarSign = value => (value[0] === '$' ? value.slice(1) : value) getReturnValue =... Add solution -
Javascript 2021-09-23 05:09:03
default value input date js
<!-- HTML --> <input type="date" id="theDate"> <script> // JQuery $(document).ready( function() { $('#theDate').val(new Date().toDateInputValue()); }); // Pure JS document.getElementById('theDate').v... Add solution