ok,so here is the scenario we have lots of single page html templates and we need to change some text and so we need some kind of script that will run on console and we can get all the texts occurence and hightlight text some color so we can know in which places is comming

I need to set local/session storage if the customer clicked on the megaMenu. This needs to be false by default and then set to true on the next page if the customer clicked on a menu button. Any help would be appreciated. The following is what I have so far, but I'm stuck on how to get megaClicked = true. And how to read it on the next page. I used to use cookies for this, but I feel that local/session storage would be better.

ok so mine problem is the when i have some array like thisvar array = [ "DS API", "DS bid strategies","Sales Management", "Ad Exchange line item", "AdX line item", "Ad Exchange inventory", "Open auction", "API"];so the issue is when we have support on 0th position "DS API" and suppose in the last have "API" only when we run the script that time got the highlighted text complete DS API but got one case for now when we add "API" in the 0th position like below arrayvar array = [ "API", "DS API", "DS bid strategies","Sales Management", "Ad Exchange line item", "AdX line item", "Ad Exchange inventory", "Open auction"];it only highlight color in API only means that if sentence have two words like mentioned in the DS API so it is only highlight API it completely ignoring DS...So, It should be highlight complete string as mentioned in the array no matter if we change the order in the array

Guys is there anyone who can spend couple of minutes help me with something that I've struggled more than a week..I have an array with elements inside, and each element has data-attribute, I need to sort them for ex in alphabetical order and apply that order to the elements with some styling..

I've done the code with else/if statements but I need to convert it to for loop and tried to do it many times, just the logic or I'm missing something.. Code is quite a lot so prefer to send it on private..

The problem with my code is that if I add new item, I need to add it to my function as well

I need to set local/session storage if the customer clicked on the megaMenu. This needs to be false by default and then set to true on the next page if the customer clicked on a menu button. Any help would be appreciated. The following is what I have so far, but I'm stuck on how to get megaClicked = true. And how to read it on the next page. I used to use cookies for this, but I feel that local/session storage would be better.

Guys that might be dumb question but couldn't find the answer..If I'm sorting a < b and when they are strings, should I make sure that they are all with the same length because I have some results that are not exactly in alphabetical order?

@dbsimeonov Could you give an example?Length doesnt matter to an extent, comparison operators (<, >) check the characters one by one. If the both strings characters (ASCII value) is same, it moves and checks the next characters.

"b" > "abcdef"//true because b > a"a" > "Z"//true lowercase comes after uppercase"abcd" > "ac"// false the first characters are checked, since they are same the comparison happens between "b" and "c"

So the secnario is i have one page on that page i want to find occurence of the text and also exactly match the item and hightligh some color so wrote js code but not efficient have some issue i am sharing the screenshots

Just to make sure I'm understanding const correctly (I'm switching every where I used let to const if I'm not reassigning the variable), a const can not be reassigned but we can manipulate the data within.For example..

takes the string toChange and turns it into a regexp, or regular expression, it's a way to match patterns, g is global, i is case insensitive, so in otherwords, search the whole string str1 for whatever string is held in toChange regardless of case or where is it, format(toChange) calls the format function and wraps that new next in the html and css to turn it red.

hmmm, that is going to be a little harder, if you know that all the text in the array will get replaced, then it's just array.length, since you will replace all those items, then you know it will do that.

if you aren't sure if you are going to find all the text in the array,

you can query the html for all the strong elements, and if there maybe other strong elements on the page you can set a custom class on your strong element in the format function, then query all those elements and get the length

so in the format function, add class="madeRed" to the <strong> element

@cmccormack I didn't have to refactor, just find and replace hah! Only have 9 uses of let (which will go down further, haven't finished refactoring some code) and currently 89 const (this is my routes file)

@JLuboff with JS a linter is a MUST. I use tslint but Im doing mostly TS. try eslint.... It suck that a lang has a lint as a near requirement, but thats JS and since its not compiled and lazy interpreted without any validation, a linter is a MUST

it might be an option you have to set. I know tslint catches them.

Using JS without a linter is like driving a car without ABS, airbags, or for that matter brakes. :)

There's a new object property check feature coming, not sure when or what it's called but I think it's pretty cool. You can do something likeconst prop2 = object?.prop1?.prop2 and I think you just get undefined if prop1 doesn't exist

@anthonygallina1 It's a public room. If they don't want to be disrupted, there's the option for a private chat. Besides, I have no idea what they're talking about. So others in this room that aren't part of their convo could help you out in the meantime :)

Nah. I've put the project on Github hoping it'd be picked up by the community as to continue its development and move it towards the next level. But aside from lots of ppl downloading it, only 1 person actually contributed. And he messed it up xD

Its stupid, but its a historical problem affecting many langs. Many people call it a feature, but if you study the evolution and where it came from, its not. And it leads to lots of bad code when its used purposefully and serious interop problems with other languages.