JSFiddle - React, Tailwind, and code Playground
by whatisthebigpicture
JavaScript
const data = ["10", "2"];
console.log(data);
const ids = data.join(", ");
const newIds = data;
console.log(ids);
console.log(newIds);
const placeholders = Object.keys(ids).fill('?').join(", ");
const newPlaceholders = Array.from('?'.repeat( newIds.length )).join(', ');
const vals = Object.keys(ids).map( (key) =>
{
return ids[key];
});
const newVals = newIds;
console.log( placeholders );
console.log( newPlaceholders );
console.log( vals );
console.log( newVals );