[Solved] Reverse the String in JavaScript [duplicate]

I call the split function passing dash which separate each part of the string str.split(“-“).reverse().join(“-“); Description of functions used String.prototype.split(): The split() method turns a String into an array of strings, by separating the string at each instance of a specified separator string. const chaine = “Text”; console.log(chaine.split(”)); // output [“T”, “e”, “x”, “t”] Array.prototype.reverse(): … Read more

[Solved] Can anyone explain the following JavaScript code for unique value how is it internally compared with each other [closed]

return arr.indexOf(value) === arr.lastIndexOf(value); You have an array. Every element in the array has an index. .indexOf() will give you that index. So if an element is unique, the first index it appears at is the same as the last index. If the element would not be unique, the lastIndex will be higher than the … Read more

[Solved] how to refresh an iframe in php page [duplicate]

<script type=”text/javascript”> var timer; function refreshIframe(){ if(timer) clearInterval(timer) timer = setTimeout(refreshIframe,5000) var iframe = document.getElementById(‘iframe’); iframe.src=”http://google.com”; } refreshIframe(); </script> <iframe id=”iframe” src=”http://google.com” width=”100%” height=”300″> <p>Your browser does not support iframes.</p> </iframe> Demo: http://jsfiddle.net/GqvZS/3/ solved how to refresh an iframe in php page [duplicate]

[Solved] Custom order list of links [closed]

TinySort is a small script that sorts HTMLElements. It sorts by text- or attribute value, or by that of one of it’s children. The examples below should help getting you on your way. This doesn’t use jQuery and it is fast in performance. TinySort used to be a jQuery plugin but was rewritten to remove … Read more

[Solved] Javascript – verify empty inputs

you have an error in your code, there is one closing bracket too much change if (document.form[‘form’][‘name’].value != “” && document.form[‘form’][‘city’].value != “” )) { to if (document.form[‘form’][‘name’].value != “” && document.form[‘form’][‘city’].value != “” ) { 1 solved Javascript – verify empty inputs

[Solved] How to foreach JSON to HTML ul li [duplicate]

With vanilla JS, you can loop through the array with the forEach method and construct the li elements accordingly. var data = { “gists”: [ { “name”: “Get the title”, “id”: “beaf8a106e76f4bb82a85ca3a7707a78”, “category”: “Function” }, { “name”: “Get the content”, “id”: “c6ae7c55aa27f8b6dbeb15f5d72762ec”, “category”: “Uncategorized” } ] }; var container = document.querySelector(‘#container’); var ul = document.createElement(‘ul’); … Read more

[Solved] This code does’t run and gives no error [closed]

You forgot to remove the remove class so it stays hidden. No need for all the if statements, one option is to add a data-tabid to your anchors and use that as the id to display the divs. <!DOCTYPE html> <html> <head> <script src=”https://stackoverflow.com/questions/17261287/jquery-1.9.0.js”></script> <title>test</title> <style type=”text/css”> body, html, div, ul,li,a {margin:0; padding:0;} body {font-family:arial;font-size:12px;} … Read more