Web and Software Frontend Developer. Used to work in Full-stack JavaScript.Been at this for a few years now, and think I now understand my specific domain pretty well. Still a lot to learn though.
Location
Manchester, UK
Education
Web Systems Design BSc at Sheffield Hallam University, Sheffield, UK
functiontoTable(datalist,isFirstRowHeader=false,isIndexed=false){letheaders=[]if(isFirstRowHeader&&datalist&&datalist[0].length>0){// parse first rowheaders=datalist[0]if(isIndexed&&headers&&headers.length>1){headers.unshift('')}}constheaderRowHTML=toHtmlHead(headers)constbodyHTML=toHtmlBody(datalist.slice(isFirstRowHeader?1:0),isIndexed);return`<table>${headerRowHTML}${bodyHTML}</table>`}consttoHtmlHead=headers=>{return`<thead><tr>${headers.map(header=>`<th>${header}</th>`).join('')}</tr></thead>`}consttoHtmlBody=(bodyData,isIndexed)=>{return`<tbody>${bodyData.length>1?bodyData.map((row,index)=>`<tr>${isIndexed?`<td>${index+1}</td>`:''}${row.map(cell=>`<td>${cell}</td>`).join('')}</tr>`).join(''):bodyData}`}
I think that's all a bit messy though and I could do it even simpler... Just would need some more thought to it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Es6+ JavaScript
I think that's all a bit messy though and I could do it even simpler... Just would need some more thought to it.