This is a simple question I think.  I am trying to search for the occurrence of a string in another string using regex in JavaScript like so:   var content ="Hi, I like your Apartment. Could we schedule a viewing? My phone number is: ";   v...
I want to convert below string to an array in javascript.  {a:12, b:c, foo:bar}   How do I convert this string into array of objects? Any cool idea?...
I am trying to replace the backslash (escape) character in a Javascript string literal.   I need to replace it with a double backslash so that I can then do a redirect:  var newpath = 'file:///C:\funstuff\buildtools\viewer.html'.replace(/\\/g...
I was reading Douglas Crockford's web page, JavaScript: The World's Most Misunderstood Programming Language, and I couldn't help but notice that, under Design Errors, he mentions "the notation for literal regular expressions." Wha...
It seems that the following technique for checking the existence of an object member produces an error because the 'bar' parent object hasn't been declared before the check, which means I either have to declare it before the check or use...
Just reading some of the JS tuts on Mozilla and came across the statement "You should not use an object literal at the beginning of a statement. This will lead to an error or not behave as you expect, because the { will be interpreted as the begi...
In the following code the clearTimeout() function doesn't seem to clear the timer. Please note: I've stripped the code down a bit to show the relevent parts. Any ideas?  var Gallery = {     next: function()    {    // does stuff    },...
In JavaScript there are both Object literals and function literals.  Object literal:  myObject = {myprop:"myValue"}   Function literal:  myFunction = function() {    alert("hello world"); }   What is the significance of the word liter...
I'm retrieving an array of objects from a hidden html input field.  The string I'm getting is:   "{"id":"1234","name":"john smith","email":"[email protected]"},{"id":"4431",...
whats the best practice to use these?  var x = { a: 'a', eat: function() { }, ... }   vs  var x = function() { var a = 'a'; this.eat = function() { }}   the above needs to be initiated:  new x();   can someone help me explain the impo...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.