What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-27 09:19:03
hex to rgb function
function rgbToHex(r, g, b) { return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); } function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if(result){ var... 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-20 22:17:02
capitalize first letter of each word javascript
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
TypeScript 2021-09-20 18:54:02
javascript capitalize all words
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
Javascript 2021-09-19 12:31:03
how to capitalize string in javascript
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
Javascript 2021-09-18 23:57:02
javascript remove underscore and capitalize
function humanize(str) { var i, frags = str.split('_'); for (i=0; i<frags.length; i++) { frags[i] = frags[i].charAt(0).toUpperCase() + frags[i].slice(1); } return frags.join(' '); } humanize('humpdey_dumpdey'); // > Humpdey Dumpdey Add solution -
Javascript 2021-09-18 08:17:05
javascript get all cookies
var getCookies = function(){ var pairs = document.cookie.split(";"); var cookies = {}; for (var i=0; i<pairs.length; i++){ var pair = pairs[i].split("="); cookies[(pair[0]+'').trim()] = unescape(pair.slice(1).join('=')... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5