Answer the question
In order to leave comments, you need to log in
How can such a function be implemented in JS?
There is code, you need to wrap it in a function and call the function
var massiveData = {
DataType: 'Key;;Key;;Key;;Sticker;;Sticker;;',
DataCat: 'Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;Normal;;StatTrak;;Normal;;StatTrak;;StatTrak;;StatTrak;;Normal;;StatTrak;;StatTrak;;StatTrak;;Normal;;StatTrak;;★;;' ,
// GET DATA
};
function getKeys(requestingKey){
var initKey = massiveData; var countKey = 0;
var splittingType = massiveData.DataType.split(';;');
for(i=0;i < splittingType.length;i++){
if(splittingType[i] == requestingKey){countKey = countKey + 1;}else{}
}return countKey;}
getKeys();
function getNormal(requestingSTrack){
var initSTrack = massiveData; var countSTrack = 0;
var splittingCat = massiveData.DataCat.split(';;')
for(i=0;i < splittingCat.length;i++){
if(splittingCat[i] == requestingSTrack){countSTrack = countSTrack + 1;}else{}
}return countSTrack;}
getStatTrack();
console.log(getStatTrack('Normal'));
console.log(getKeys('Key'));
#beginScript
|DV|[CountKeysFind] = (|EVAL|
var DataType = 'Key;;Sticker;;Sticker;;Key;;Key;;Key';
var splittingType = DataType.split(';;');
var countKey = 0;
function getKeys(theValue) {
for(i=0;i < splittingType.length;i++){
if(splittingType[i] == theValue){
countKey = countKey + 1;
}
}
return countKey;
}
getKeys('Key');
|EVAL|)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question