Skip to content
Advertisement

Tag: concatenation

Displaying a concat array in an HTML element

I have multiple arrays that have been combined depending on user response. The only problem I have at this point is getting this final array to show up in the text field for the end user to see. Thanks for all the potential help! I have narrowed the problem to either the write function or the generate function. The booleans

Why does Javascript only type-cast for string concatenation on strings that are already assigned?

I noticed something strange when messing around with strings and numbers in a Javascript console. Doing this: “$99.9” += 0 causes SyntaxError: Invalid left-hand side in assignment. But if I assign the string to a variable, the behavior is different (and more in line with what we’ve come to expect/accept from Javascript) let str = “$99.9” str += 0 //

Concatenate Object values

I have a JavaScript Object and I’m sure the value of any key is an array (even empty in some case): Aside from using Underscore, is there any way to concatenate all the values of this Object (and create a new array)? At the moment I get the keys name using Object.keys, then I loop and concatenate. Any help is

Getting current date and time in JavaScript

I have a script that prints the current date and time in JavaScript, but the DATE is always wrong. Here is the code: It should print 18/04/2012 15:07:33 and prints 3/3/2012 15:07:33 Answer .getMonth() returns a zero-based number so to get the correct month you need to add 1, so calling .getMonth() in may will return 4 and not 5.

Advertisement