This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` | |
? `${T}${Capitalize<SnakeToCamelCase<U>>}` | |
: S; | |
type SnakeCaseType = { | |
first_name: string; | |
last_name: string; | |
age_in_number: number; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomPick(source = [], anyNumber = 1) { | |
if (source.length > 0) { | |
let result = []; | |
// Duplicate original array | |
let poppedArray = [].concat(source); | |
let currentLength = poppedArray.length; | |
for (let i = 0; i < anyNumber; i++) { | |
// Generate random number to pick an element inside array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input type="text" id="input-1" placeholder="Input 1"> | |
<input type="text" id="input-2" placeholder="Input 2"> |