Skip to content

Author: admin@master

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…

min_by,max_by equivalent functions in javascript

Is there any javascript library that contains functions like min_by,max_by in Ruby, which allow you pass a lambda as a criteria to compare. I found not such things in JQuery and underscore.js . Answer To use this in the same way as Ruby, ie call it on the array: So the ruby example becomes: or: