Comments (2)
Yes. That's because the two arrays are not the same object. You can specify
that they should be treated as the same object by specifying an equality
function to use. Example (untested):
var hash = new Hashtable({
equals: function(k1, k2) {
if (k1 === k2) {
return true;
}
if (k1 instanceof Array && k2 instanceof Array) {
if (k1.length !== k2.length) {
return false;
}
for (var i = 0, len = k1.length; i < len; ++i) {
if (k1[i] !== k2[i]) {
return false;
}
}
return true;
}
}
});
Original comment by [email protected]
on 28 Feb 2014 at 12:31
- Changed state: Invalid
from jshashtable.
Ok thanks for responding.
The thing is it worked when the object in the array is a string, not a date
object, so it is something to do with date objetcs maybe, and not arrays
being different.
I temporarily solved the problem by not using transforming date objects
into string before creating my arrays. I'll try the equals function
solution.
Original comment by [email protected]
on 28 Feb 2014 at 10:45
from jshashtable.
Related Issues (12)
- Using an ActiveX object (such as XMLHttpRequest in IE 6) as a key gives an error HOT 1
- Can't use request object after storing It in jshashtable HOT 4
- package manager
- How can we create a deep copy of Hashtable object ?
- API function toQueryString HOT 4
- Suggestion: HashSet.add should always update/set key value, regardless of equality HOT 12
- Extern File for Closure Compiler HOT 1
- (bug report + fix) jshashset entries are not replaced when using equalityFunction HOT 6
- Hashtable does not accept array objects containing XML document types as keys HOT 2
- Complemented HOT 2
- replaceDuplicateKey:false is not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jshashtable.