Forbes magazine logo Ranked Best Coding Bootcamps 2023

Questions and Answers

About 153 questions

How to solve Draft.js convertFromHTML converting image <img> tags into 'unstyled' contentBlock type instead of 'atomic' content block type?

I solved this by iterating through the contentBlocks generated by convertFromHTML and checking if it has an entity type of image then editing the cont ...

Asked on 7 February 2018

Truncate a string (Basic Algorithm Scripting)

Hi everyone, This is my solution for Truncate a string My solution works but I don't like my code(too many if else statement).Is there a better way t ...

Asked on 7 February 2018

How to import some css files as global in js while the rest are imported as local

I use webpack to handle my css files. I configured my css and sass loaders to import files as modules. But sometimes I want to import some files as gl ...

Asked on 7 February 2018

How to solve Draft.js convertFromHTML combining adjacent paragraphs <p> tags into one contentBlock

I solved this by adding a custom DraftBlockRenderMap element for paragraph <p> tags for convertFromHTML because the default one doesn't contain it. Ch ...

Asked on 7 February 2018

JavaScript variables in plain english

Asked on 7 February 2018

Mocking node environment fetch() function using Jest.

I am developing a node client which is a library consuming an API. The various functions return a Promise using the fetch() function. The npm package ...

Asked on 7 February 2018

Why is it that parseInt(8,3) == NaN and parseInt(16,3) == 1?

See for now

Asked on 7 February 2018

What IDE do you use for writing Javascript code?

Atom! I used Sublime before, but just moved to Atom and very happy with it!

Asked on 7 February 2018

Need help with my Wikipedia viewer

I am making the getJSON call and it never seems to get to the callback function - what am I doing wrong? I never see the text "json call was made" $( ...

Asked on 7 February 2018

How to split camel case and add hyphen in JavaScript

You can use the following regex. var myStr = 'thisIsAString'; myStr.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase(); // -> "this-is-a-string"

Asked on 7 February 2018

Profile Lookup

function lookUp(firstName, prop) { for (var i = 0; i < contacts.length; i++) { if (contacts[i].firstName === firstName && contacts[i][prop]) { ...

Asked on 7 February 2018

I don't know how to code "Counting Cards", can you give me some prompt?

See Here is a pseudo code I would give you as prompt: var count = 0; function cc(card) { // ...

Asked on 7 February 2018

Diff Two Arrays

Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric ...

Asked on 7 February 2018

Potential infinite loop while num > 700

potential infinite loop while num > 700. function sumPrimes(num) { var arr = []; var ifTrue = 1; ...

Asked on 7 February 2018


问题是:实现一个摧毁(destroyer)函数,第一个参数是待摧毁的数组,其余的参数是待摧毁的值。 一开始是这样的: function destroyer(arr) { for(var i=1;i<arguments.length;i++){ arr=arr.filter(funct ...

Asked on 7 February 2018

Help with Local Weather: Using JSON location data in weather API

I'm having problems making a request to the open weather api. Here is a link weather app. I can't get any kind of error or response from the open weat ...

Asked on 7 February 2018

SyntaxError: expected expression, got keyword 'else'

source: If (computerChoice <= 0.33) { computerChoice = "roc ...

Asked on 7 February 2018

How to build a Chrome extension?

Starting with

Asked on 7 February 2018

What's the difference between HTML 5 and HTML4

Please give the main difference concerning a front-end web developer. The official difference is documented on Chan ...

Asked on 7 February 2018

What's the difference between onMouseDown and onClick

I am starting to see people use onMouseDown instead of onClick. What's the difference between the two and why would I want to use onMouseDown instead. ...

Asked on 7 February 2018

Trusted by

Students and instructors from world-class organizations

Imperial College London
Carnegie Mellon University
City University of Hong Kong
Hack Reactor
Cisco Meraki
University of Oxford
Boston College
Bombardier Aerospace
University of St. Andrews
New York University
Minerva Schools at KGI
Merrill Lynch
Riot Games
JP Morgan
Morgan Stanley
Advanced Placement®
The University of Hong Kong
University of Toronto
Hello Toby
Goldman Sachs
General Assembly
McGill University

Join the upcoming Cohort #91

Enroll for July 1st, 2024