Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wynn

Members
  • Joined

  • Last visited

  1. I agree with the above, it's pretty confusing to have all the links swapped around. Plus the code wont persist between pages so I take it you're planning on using AJAX to load content? Anyway, to answer your question about the nth-child. The selector you pass into jQuery is a String and Strings (prior to ES6) don't take variables. jQuery has a $.eq method http://api.jquery.com/eq/ This selects an element at a specific index and you can pass in a variable; eg. var index = 2; $("li").eq(index);
  2. Because you're using the wrong jQuery methods. $.removeData removes previously stored data on the jQuery object using $.data, not content. https://api.jquery.com/jQuery.removeData/ $.append does what it says, appends content to a selected element. https://api.jquery.com/append/
  3. To stop a setInterval you need to use clearInterval, but you need to name the setInterval so you can reference it. for example: var timer = setInterval(callback, 1000) $('button').on('click', function() { clearInterval(timer) }); In your setInterval you're creating a new date object every second, converting it to a number and then subtracting a start time. That's a whole lot of code when all it's really doing is starting from 0 and increasing by 1000 every second. var elapsedTime = 0; setInterval(function() { elapsedTime += 1000; console.log(elapsedTime) }, 1000) does the same thing but more accurate Converting this into minutes and seconds just takes a little Math (the number 60 comes in useful), have a search on stackoverflow for some examples.
  4. It's been removed from the specs, no one used it, only one browser ever implemented it. No longer a thing.
  5. There are plenty of developers who have or do suffer from mental health issues, bipolar disorder, alcohol / drug addiction, homelessness etc. These things are treatable or least manageable and in no way mean that the person with the illness is unemployable.
  6.    rbrtsmith reacted to a post in a topic: jQuery no longer needed to be learnt?
  7. I grabbed some stats regarding jQuery. downloads from NPM: 26,079 in the last day 463,725 in the last week 1,986,544 in the last month Sites using jQuery (taken from Libscore and Builtwith) Builtwith knows of 59,985,868 sites using jQuery 7,221 of the top 10K 74,397 of the top 100K 766,312 of the top 1M A handful of these sites: Netflix, airbnb, NYTimes, linkedin, Amazon, Baidu, Twitter, pinterest, Live.com, MSN, instagram, yandex, ebay, tumblr, imgur, stackoverflow, github, whatsapp, dropbox, CNN, Adobe, quora, PayPal, craigslist, ask, walmart, nbcnews, vimeo, apple, reddit, imdb, mozilla, ehow, Huffingtonpost, AOL, forbes, Foxnews, American Express, Samsung, mailchimp, telegraph, Bloomberg. I only checked the first four before posting and they do use jQuery or a custom build of it. I think it's fair to say that jQuery is still relevant and will be for some time.
  8.    Wynn reacted to a post in a topic: how do you learn?
  9.    rbrtsmith reacted to a post in a topic: Codeeval challenge
  10.    Wynn reacted to a post in a topic: Codeeval challenge
  11. Wynn replied to NullDrone's topic in Frontend
    matchLettersToWineName('nanan naan na | anan') // nanan naan na I think names / strings should include all the letters including duplicates. Since CodeEval doesn't support ES6 here's a working ES5 solution (you can place it inside the boilerplate CodeEval provides). // line = 'Chardonnay Sauvignon | ann' var namesIncludeLetters = function(input) { var names = input.split(" | ")[0].split(" "); var letters = input.split(" | ")[1].split(""); var includesEveryLetter = function(str) { return letters.every(function(char) { var index = str.indexOf(char); str = str.replace(char, "_"); return index > -1; }); } return names.filter(includesEveryLetter).join(" ") || 'False'; } console.log(namesIncludeLetters(line)); The difference is it's checking that every letter is included in the string and removes it from the string to make sure it's not matched against recurring letters. ...in ES2016 const namesIncludeLetters = input => { const [names, letters] = input.split(" | "); const includesEveryLetter = str => [...letters].every(char => str.includes(char) && (str = str.replace(char, '_'))); return names.split(" ").filter(includesEveryLetter).join(" ") || 'False'; } console.log(namesIncludeLetters(line));
  12.    fleur reacted to a post in a topic: General JavaScript
  13. Wynn replied to Jack's topic in Frontend
    It's a computed property. By using square brackets we're no longer limited to using strings as object keys, we can use variables and expressions etc.
  14.    Jack reacted to a post in a topic: How many H1 tag can be used on a webpage?
  15.    rbrtsmith reacted to a post in a topic: How many H1 tag can be used on a webpage?
  16.    Wynn reacted to a post in a topic: How many H1 tag can be used on a webpage?
  17. A lot of literature on the web was following the spec, but there are currently rewrites of the spec taking place to avoid author confusion. The page linked to in the comments of the article Robert posted demonstrates things clearly. Using multiple H1's essentially flattens the document. https://www.w3.org/wiki/HTML/Usage/Headings/h1only If you read through some of the related links at the bottom of the above page: https://github.com/w3c/html/issues/110 Steve Faulkner states: The same issue links to a rewrite of the Article section of the spec, which states: So apparently we're now advised to have only one H1 tag in the root of the document and subsequent H2 - 6 depending on the nesting of content.
  18.    fleur reacted to a post in a topic: Remote server connection in React
  19. What url are you trying? There's nothing wrong with jQuery, SuperAgent or Fetch, they all work as expected. The problem lies with the urls you are using: The first url in this thread is returning JSONP but even if you requested JSON (by using nojsoncallback=1) that Flickr endpoint is not CORS enabled. The second David Walsh url you've tried is not CORS enabled either. The error you've posted above suggests that the response isn't valid JSON. When making cross-origin JSON requests, unless the response has the header "Access-Control-Allow-Origin: *" you will receive an error.
  20. >> SyntaxError: Unexpected token : You probably have a typo in your code.
  21.    Wynn reacted to a post in a topic: Remote server connection in React
  22. ...also, the data returned is an object not an array, there is no data[0]. console.log(data) // => Object { title: "LS 2008 Pool", link: "https://www.flickr.com/groups/ls200…", description: "Dette er ei gruppe på Flickr, der a…", modified: "2008-07-31T06:31:53Z", generator: "https://www.flickr.com/", items: Array[20] } so either use the data object itself username: data.title or if you want the first item in data.items const first = data[0]; // <= change this const [first] = data.items; // <= to this
  23. Wynn replied to NullDrone's topic in Frontend
    You're output needs to be a string not an array, the array is just being used to keep the results of the for loop in, you'll need to join it at the end. console.log(arrline.join(" ")); There's also no need for the && i != 0 in your if statements if you start your for loop from 1 instead of 0, and always use strict equality === rather than == .
  24.    Wynn reacted to a post in a topic: Fizzbuzz
  25. Wynn replied to NullDrone's topic in Frontend
    Robert, that's not what codeeval is asking for. The output is expected to be a string containing all numbers up to and including the last number in the input. The first two numbers in the input string are the divisors for fizz and buzz. eg. // if line = "3 5 15" output = "1 2 F 4 B F 7 8 F B 11 F 13 14 FB" // if line = "2 6 12" output = "1 F 3 F 5 FB 7 F 9 F 11 FB"
  26. Wynn replied to NullDrone's topic in Frontend
    You need to be creating a string of numbers up to n, with appropriate numbers being replaced with F, B or FB and then console.log the resulting string. You're on the right track. The way you're approaching it you need to create an array to keep the results in, instead of console.log, push the result to the array then after the for loop you can console.log(results.join(" ")). Ideally you should also convert any strings to numbers before performing any math on them. To get the different values from the input string // line = "3 5 25" var arr = line.split(" ").map(Number); // arr = [3,5,25]

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.