1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Still cant understand JS!! Whats the purpose of it ??!!

Discussion in 'JavaScript' started by imza86, Feb 18, 2017.

  1. #1
    Hi, i have always been a web designer or AKA front end web developer. An example of site that i just did for my portfolio will be this : http://www.noor-azmi.com/saj2/

    It is done via HTML5, photoshop, CSS3, and also bootstrap. For me this is sufficient to build a website. Ok so i have added a few JQuery in there, the "Click here " buttons. I understand Jquery more towards the effects such as fade, slide.

    I have gone through a few javascript tutorials and i still cant understand most of it! Why do u need arrays and all those things for a website?

    Another is that because when i do a site, it does not seem to require javascript and it is difficult to practice in the real projects.
    SEMrush
    Now i have come to a point in my career where whenever i am looking for a web designer job they always list javascript as one of the requirements. Shit. Anyone can help ? Thanks!
     
    imza86, Feb 18, 2017 IP
    SEMrush
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,622
    Likes Received:
    717
    Best Answers:
    151
    Trophy Points:
    420
    #2
    First: jQuery IS javascript. Some of the syntax is modified to make it "simpler" to fetch DOM-elements, but it's javascript. Nothing else, nothing special.

    Then, what is javascript good for. That all depends. Today, quite a lot can be done using pure HTML and CSS. CSS support animations and transitions, but it also still has some limits. For instance, it has no "parent"-selector.

    Javascript is (or, rather, should be) used to improve the user-experience on a site. One thing that is popular, is AJAX-loading of content, searches, updates etc. so there is no visible page-load. Everything is sent via javascript AJAX-calls, to whatever back-end/server-side script you have running, that does the actual updates/fetching of data. Javascript can also be used to attach events to specific elements, create dynamic elements on the fly, and to do simple things like add/remove classes based on selections and such.

    It can be used to improve forms, both visually and functionally, it can be used to provide sorting for elements like tables and/or lists, it can be used for smoother animations, and so on.

    A website should, at least the basic functionality, work with javascript disabled, but many modern pages won't work very well unless javascript is enabled.
     
    PoPSiCLe, Feb 18, 2017 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    You need them for programming, whether it's for a website, a phone, a SmartTV, a laptop - anything that runs software. (You use strings, right? Strings are just arrays of type character.)

    The site doesn't require Javascript, your software does.

    Sure. Learn programming. Then learn Javascript. If you don't know programming, you're not a web developer, you're a web designer. (You're designing the look of the site, but you're not developing any software for it. Oh - HTML and CSS aren't programming languages. Bootstrap is a framework, not a language. And you can't learn one little piece of jQuery - either learn Javascript or stop using snippets you don't understand. [Using code you don't understand is just begging for your site to be taken over.])
     
    Rukbat, Feb 28, 2017 IP
    COBOLdinosaur likes this.
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    8,439
    Likes Received:
    1,511
    Best Answers:
    220
    Trophy Points:
    515
    #4
    Well first off, your site HAS JavaScript, so you did "need" it. NOT that you actually needed it given what your site does, but you used the mouth-breathingly idiotic DERP that is bootcrap, and that meant the equally idiotic dumbass nonsense that is jQuery since the new bootcrap.js requires it.

    See this in your code?
    
    <script
      src="https://code.jquery.com/jquery-3.1.1.js"
      integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="
      crossorigin="anonymous"></script>
    
      <script>
    $(document).ready(function(){
        $("#btn-products").click(function(){
            $("#products-toggle").slideToggle();
        });
    
        $("#btn-services").click(function(){
            $("#services-toggle").slideToggle();
        });
    
        $("#btn-partners").click(function(){
            $("#partners-toggle").slideToggle();
        });
    
    });
    </script>
    
    Code (markup):
    That's JavaScript... the fat blaoted train wreck of asshattery that is jQuery, along with JavaScript to make your derpaderp menu work. Now, really, you don't need JavaScript for that, but since you're using this numbskullery:

    
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    
    Code (markup):
    Which also means this tuchas plowing rubbish:
    
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    
    Code (markup):
    You are most certainly using JavaScript, even if you don't seem to realize it.

    As to what JS is FOR? Basically anything that HTML and CSS cannot handle on their own -- SADLY a lot of developers just blindly dive for it for everything, see the mind-numblingly asinine dipshittery that is what bootcrap does with it; as if pissing all over your markup with presentational classes for NOTHING and taking a huge dump on accessibility wasn't bad enough... nope, then they have to smear "JS for nothing" all over it.

    But there are legitimate usage scenarios... Let's say you wanted one of those goofy slideshows, while modern CSS on its own can do one, you can't select a frame or pause transitions or CSS animations. A JavaScripted slideshow most certainly can... and it will typically use a nodeList -- a complex cousin to arrays -- to do so!
    For example:
    http://www.elementalsjs.com/liveDemos/eFlipperTest.html

    Admittedly, in my case I use CSS3 to do the heavy lifting. The back end JavaScript just swaps classes on elements to trigger the CSS changes.

    If you had a complete table on the screen you wanted to easily allow users to sort without reloading the whole page? JS can do that too.
    For example:
    http://www.elementalsjs.com/liveDemos/_.uSortElement_tbody.html

    So it does serve a purpose. The best way to think of it is:

    HTML: Say what things ARE, NOT what you want them to look like.
    CSS: Say what you want things to look like
    JavaScript: Enhance the page's functionality with things neither of those can do on their own.

    Such enhancement done CORRECTLY should "gracefully degrade" if scripting is off or blocked. Sadly too many "experts" now saturate their websites with inaccessible non-degrading JavaScript, and that can alienate users with accessibility needs.

    But then so could your DIV+IMG doing H1's job, H1+H2 doing a H2+P's job, JavaScripted dropdown menus pissing on accessibility, Javascripted show/hide on the buttons doing a checkbox's job, gibberish invalid tag closures...

    Your site actually has a LOT of bad practices and broken nonsensical gibberish... and a slew of JavaScript (for nothing) that makes one really wonder what in blazes you're on about...
     
    deathshadow, Mar 2, 2017 IP
  5. yedort

    yedort Member

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    33
    #5
    Basically, on a web page: HTML is the markup for printing stuff on a webpage. CSS styles the display. And Javascript is used for animations and interacting with the client/browser/user. They're all client-side programming languages and described as front-end development.

    But the only area of Javascript use is not web. For example gaming industry uses it, such as Unity3D.
     
    yedort, Mar 9, 2017 IP
  6. Rokis

    Rokis Member

    Messages:
    60
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    45
    #6
    This thread explained me what it is and why it's needed or not needed for that matter to be used in the website you are building.

    Thanks to everyone answering and OP for raising a question so I didn't have to.
     
    Rokis, Mar 17, 2017 IP
  7. Kaspi

    Kaspi Member

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #7
    And then you come to the world of modern front end (web) apps where JavaScript does everything.
     
    Kaspi, Mar 20, 2017 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    8,439
    Likes Received:
    1,511
    Best Answers:
    220
    Trophy Points:
    515
    #8
    Except when it doesn't or shouldn't, if not for most people sleazing out JS any old way not knowing enough about HTML or CSS to be writing JS in the first place.

    Of course if they did, they wouldn't be making bloated slow inaccessible web crapplets that just piss off users.
     
    deathshadow, Mar 20, 2017 IP
  9. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #9
    Now, now, DeathShadow - not everyone who writes websites actually knows how to write websites. :)
     
    Rukbat, Apr 16, 2017 IP
  10. mmerlinn

    mmerlinn Well-Known Member

    Messages:
    1,527
    Likes Received:
    163
    Best Answers:
    5
    Trophy Points:
    190
    #10
    Not everyone does, BUT THE PEOPLE GETTING PAID (THE PROFESSIONALS) HAVE NO EXCUSE FOR CRAPPING ALL OVER THE WEB! If one is getting PAID for developing websites, one is SUPPOSED to know what one is doing, but sadly the "Professional Web Developers" create MOST of the non-working crap on the web. Based on what I see (both on the web and under the hood), I guesstimate that 95% of paid developers don't have a CLUE how to make a site that works properly. Sometimes I think the amateurs do a better job than the professionals.

    Latest pile of crap is the USPS (U.S. Post Office) site. Last month it looked decent and worked halfway decently. Someone re-invented the wheel, and now we have an UGLY site that is CLUNKY and does not work at all in any user agent that I have available. Now instead of using their site for pricing, I have to either run to the Post Office or live with perpetual hold on the phone to get price quotes. We are talking several times EVERY day. I am now considering writing my own postage calculator to avoid wasting so much time.
     
    mmerlinn, Apr 17, 2017 IP
  11. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,622
    Likes Received:
    717
    Best Answers:
    151
    Trophy Points:
    420
    #11
    Hm. I took a look at the USPS-site now. Firefox, with regular limits (Ghostery and such) installed. Mac OSX Sierra. Worked fine? Getting to where I can calculate prices is 2 or three clicks, and filling out a form. Not the BEST design, but everything works as it's intended, I think? Granted, I have nothing to compare it to, since I never saw the old version, but... what is the problem?
     
    PoPSiCLe, Apr 17, 2017 IP