Fix JS function to remove array value case repetead
$10-30 USD
In Progress
Posted over 3 years ago
$10-30 USD
Paid on delivery
Hi, I have this function:
function multiDimensionalUnique(arr) {
var uniques = [];
var itemsFound = {};
for(var i = 0, l = [login to view URL]; i < l; i++) {
var stringified = [login to view URL](arr[i]);
if(itemsFound[stringified]) { continue; }
[login to view URL](arr[i]);
itemsFound[stringified] = true;
}
return uniques;
}
function setAttr(param) {
var attr = (typeof [login to view URL]('pAttr') == "undefined") ? '' : [login to view URL]('pAttr');
var attr_ = attr, flag = false, attrT = [];
if (attr) {
for (var i = 0; i < [login to view URL]; i++) {
if((attr[i].option == [login to view URL] && attr[i].value != [login to view URL]) || (attr[i].option != param['option'])){
flag = true;
}
}
if(flag) [login to view URL]({'option':[login to view URL], 'value':[login to view URL]});
else {
$.each(attr_, function(i, v) {
//[login to view URL](v.option+'-'+[login to view URL]);
if([login to view URL]!=[login to view URL])[login to view URL]({'option':[login to view URL], 'value':[login to view URL]});
});
attr_ = attrT;
}
attr_ = multiDimensionalUnique(attr_);
//[login to view URL](attr_);
[login to view URL]('pAttr', attr_);
} else {
//[login to view URL](text);
attr_ = []
[login to view URL]({'option':[login to view URL], 'value':[login to view URL]});
[login to view URL]('pAttr', attr_);
}
}
My intention here is when I send param, like:
setAttr({option:30, value: 1});
setAttr({option:30, value: 1275});
case i repetead the call: setAttr({option:30, value: 1});
I need to remove this val in "[login to view URL]('pAttr')"
Hi,
I am a JavaScript developer. I can make changes to your JavaScript setAttr function to remove the value when the function is called again with the same value.
Hi,
I am Full stack developer with more than 8 years of working experience in different technologies.
I can fix provided js function.
Let discuss in inbox.
Thanks
Hi Dear,
I read your description carefully.
I understood what you require me to do and I am filled with confidence that I can complete your project wonderfully.
I have experience in web developing with PHP, Website Design, JavaScript, html, css, database such as MySQL over 5+ years.
I ensure:
=> The Best Quality,
=> The Shortest Time.
If you give me a chance, I will do my best to complete this project for us.
I can complete this project with the best quality in time.
I hope your kind reply.
Best Regards.
Chian Y.
I have good experience with jquery/javascript. I can do this for you. I can asure you of best solution, quality codes and on time delivery. let's connect to proceed further
✨✔⭐⭐Dear Employer⭐⭐✔✨javascript expert
I sincerely wish you to be safe and always healthy on covid19.
I have excellent APP development skills and extensive knowledge and practice in this part.
I have excellent development experience and ability in this field,
so it is safe to say that I am a very suitable developer for you.
I will help you solve this project.
Let's meet in the chat and discuss with you in detail.