Skip to content

Tag: javascript

How do I match up text labels in a legend created in d3

I am building a data visualization project utilizing the d3 library. I have created a legend and am trying to match up text labels with that legend. To elaborate further, I have 10 rect objects created and colored per each line of my graph. I want text to appear adjacent to each rect object corresponding with…

Ties are still running win messages?

I’ve been messing around with a rock, paper scissors project that codecademy gets you to try, I’m pretty happy with it but I have one problem! When the result is a tie, it logs the tie message (perfect!) but also logs the win message linked with the result! How do I get it to ONLY log the tie mess…

happy number algo question solution not working

trying to figure out this coding problem: Write an algorithm to determine if a number n is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number e…

Pass the last parameter to function – JavaScript

If I have a function with two different parameters, how can I make it so that if I input only one parameter, it will use the input as the second parameter rather than the first parameter? For example, if I have this function: and call x(3), it will use the 3 for a and return “3, 2” I want it

V-chip not issuing input event to parent

I was hoping to resolve this on my own, but I am completely stuck. Any help is welcomed. Basically, this component prints a matrix 100×10 such as this: Threat1: AssetType1 AssetType2 AssetType3 AssetType4 […] Threat2: AssetType1 AssetType2 AssetType3 AssetType4 […] Threat3: AssetType1 AssetTy…

Javascript how to change font properties to script?

I found this script which is perfect for what I need. However I would like to change the font properties to make it bold and red for the result displayed. I looked all over and tried adding it but somehow I just seem to make it not function at all when I do. Any help is greatly appreciated. Here is