Skip to content

Tag: javascript

javascript fizzbuzz switch statement

I’m currently taking the code academy course on Javascript and I’m stuck on the FizzBuzz task. I need to count from 1-20 and if the number is divisible by 3 print fizz, by 5 print buzz, by both print fizzbuzz, else just print the number. I was able to do it with if/ else if statements, but I wante…

Add tags to div using Javascript

There are quite a few similar questions, but none are quite what I need nor can I fiddle them around to fit what I’m trying to do. I have the following: And would like to, somehow, add the <span> tags around name using the above. I’m attempting to create a simple chat AI for fun, and want to…

_.chain – underscore JS

This code works fine Is it possible to use the _.chain() function to clean this code up? I’ve tried to code below, but it gives a Type error. Answer You just need to remove the first argument (arr) from each of the functions you have inside the _.chain() and _.value() (as they are now gather from the ch…

Clear the console in Firefox

Is there a way to clear the console in Firefox? In Chrome I can use… (Not sure if it works for Safari or Opera though) However I haven’t been able to find a solution for Firefox. Is this type of API not yet available? Is there a workaround that doesn’t require? Answer In firefox you can just…