Skip to content
Advertisement

Tag: each

nested if statements javascript

I’m trying to do a lookup until i found an especific value; currently using if statements like this but right now its only two levels and i dont need how many if statements will be needed until the conditions meets. Is there a way to avoid using infinite IF statements ? Answer You can make use of recursion as follow:

How to rewrite in pure JavaScript code from JQuery code?

I have some trouble using JavaScript. This is my JQuery code. I checked this question convert jquery each function to pure javascript, but cannot solve my problem. I want someone can help me. Thank you in advance. Update This is the code I tried. Answer @GrafiCode said it’s good for me to answer my own question. This is my answer.

Adding thematic break after iterating through an object

I’m using $.each to iterate through an object and I’m struggling to add a thematic break after every 7th property:value. I’m using the above code and I’m able to display each property:value on a new line on the browser, but just can’t figure out how to add the thematic break. Is it even possible? Any suggestions would be most welcomed.

Advertisement