开发者

Is it necessary to learn JavaScript before learning jQuery? [duplicate]

开发者 https://www.devze.com 2023-01-06 00:25 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Is it a good idea to learn JavaScript before learning jQuery?
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Is it a good idea to learn JavaScript before learning jQuery?

I am about to start learning JavaScript. However one friend suggested me to go in for jQuery instead since he says future is jQuery. I heard that jQuery is created from JavaScript.

In short, give me one simple reason why developers like me should invest in JavaScript. What开发者_如何学编程 is its future?


  1. Part of being a good programmer is having an interest in understanding how things work. You can't understand how JQuery works without knowing JavaScript.

  2. A good programmer has a diversity of skills. Knowing both the JQuery way to do things and the JavaScript-only way makes you more versatile.

  3. Most employers who are looking for someone who knows JQuery are probably also looking for someone who knows ordinary JavaScript.

  4. You can never achieve true expertise in JQuery without understanding JavaScript.

  5. Sometimes even a fairly lightweight framework is more than you need.

  6. If you don't ever learn to do things the hard way, you won't appreciate what's so great about doing it the easy way.

  7. Moreover, if you start by learning to do things the easier way, you'll have that much harder a time motivating yourself to learn to do it the hard way.

  8. Learning the language first without the fancy frameworks builds character.

  9. Who knows, maybe you'll want to make your own framework someday. Or even work on a new version of JQuery. To do that, you'll need to know the language.


jQuery is JavaScript and yes, it makes things a lot easier for you and you can use it without much JavaScript knowledge, and yes, it will probably become even more popular in the future.

BUT: Wherever is jQuery, there will be JavaScript. jQuery is "just" a tool. You still need "plain" JavaScript to solve some problems, e.g. string manipulation.

Imho: You cannot master jQuery if you don't master JavaScript.

And there will be situations where jQuery might be not the best solution, e.g. when you really need high performance.


For me, this is similar to other questions I read here on SO about web frameworks and programming languages, like: Do I have to learn/know PHP if I want to use [Zend | symfony | CodeIgniter].

Seriously: If you don't understand the basics, you cannot use a tool efficiently.


JQuery is a library, written in Javascript, the language. It is almost always the case that learning the library without learning the language is impractical if not impossible, irrespective of the library and the language in question.


jQuery will come and go.

You are a web developer, right? Javascript is huge. Think how much time people spend using a web browser. The entire time they are interfacing directly with html dom, css, and javascript. Or, less and less, flash and "actionscript" (which is basically javascript).

Learn javascript, learn css, learn the dom. Refer to ecma-262 versions 3 and 5 and publications by w3c and whatwg. Read mozdev, cross-check msdn.

After that, take a look at jQuery if you want. You will probably find that you don't need it for 99% of the stuff people use it for.


Every browser has its own implementation of Javascript ( the language ) and the DOM ( library for manipulating elements on the page ). Because of the inconsistency of each browsers Javascript + DOM with another, jQuery ( created with Javascript ) was created as a wrapper that internally deals with these inconsistencies so you can use the easy API.

Underneath the hood, most of your problems are already solved for you so you don't have to think about issues like:

  • invoking functionality for the DOM ready event
  • a consistent way of attaching event handlers for click, mouseover and other events, attaching multiple functions to the same action
  • returning the proper values for elements as well as viewport ( window ).

Because jQuery is a Javascript library you won't master it without mastering Javascript. See my previous answer for recommendations for learning Javascript.


You do not need to know JavaScript in order to use jQuery.

This depends what you want of course.

If you want to put together web pages and don't consider yourself the 'programming type' or you simply don't like JavaScript, then don't bother, spend your time where it will matter most.

Your also asking this question on a site where majority of users are developers so your going to get a lot of people who say you should learn JavaScript, I say learn it if it interests you.

There are pleanty of jQuery solutions out there and support so that you don't need JavaScript.


jQuery IS JavaScript. When you are writing jQuery, you are writing in javaScript. All a library like jQuery consists of is a premade collection of functions you can use in your JavaScript programs.

So, you have to know JavaScript syntax and the core language in order to use jQuery at all. A good book for that is Douglas Crockfords the Good Parts.

What you do not need to know as much about is the DOM API, since that is mainly what jQuery smooths over for you. It helps a lot to understand the concepts of the DOM, though. You still need to know what an element is, and what attributes are.

You also need to know about CSS in order to use jQuery effectively. The key concepts here are classes, IDs, positioning, visiblity and display, among others.


Yes you CAN use jQuery without knowing JavaScript. In fact, I knew very little about JavaScript originally but by using jQuery it sparked my interest to learn it and so I did. Years later I can say I am very proficient with both.


As you progress in your programmer expertise you would find that you go from library writer to library user. This is quite natural and OK. When you are starting off, all you have is the basics. You write your code in terms of those basics and over time find that you need to bunch common code in a library for easier reuse.

Sometime later you find that someone has already done just that and created a library that's even better than yours. You then switch from being library writer to library user. jQuery is one such library and you really need to know JavaScript to be able to draw a line in your head as to where jQuery is and where JavaScript is.

My advice, in light of the above, would be to learn the underlying technology before getting started with the library (which is what jQuery is). However in this case I would make an exception - skip DOM manipulation. DOM is a stupid abstraction and will have you tear your hair out in no time flat. jQuery wraps it up quite nicely, might as well get stuck into that after you understand JavaScript basics.


you can read this


edit

However one friend suggested me to go in for jQuery instead since he says future is jQuery.

If you go for jQuery, of course you are still learning Javascript...
You can not understand jQuery if you can not understand how Javascript works.
Some programmers learning jQuery wihtout the knowledge of javascript thought that they are learning a new programming scripting language. But they did not know that jQuery is not. They are just using jQuery as a tool. They are still coding Javascript...

If you want your Javascript codes to be cross-browser,

with less hassle, go for jQuery... but still you need the basic (or at least) knowledge of Javascript.

0

精彩评论

暂无评论...
验证码 换一张
取 消