Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

Is this jQuery or Pure JS?

I see some jQuery comments there, and btw, I found a gold mine but...

Is this pure JS or jQuery? I'm sure it's jQuery with no pure JS, ok, some things like events are with pure JS because that's how it is, but in general this is jQuery right?

So if yes, Kelvin, if you're reading this, or anytone else :D Where the ehll should i see pure professional JavaScript code?

I understand what the code is saying, maybe not 100% of it, but most of it yes. Prototyping etc.. I totally understand it. Write it on my own? mmm to a degree yes.

https://github.com/twbs/bootstrap-sass/blob/master/assets/javascripts/bootstrap.js#L339

Btw, Sass in bootstrap, is just a gold mine, agree? Learn that and I could be in the top % of the HTML5, CSS3 and Sass developers right. They are already uding best practices, a lot of Sass power, dry CSS, that's something I have been doing my self, but now I just found someone who is ahead in the inventing the wheel, which is boostrap, so I already know CSS etc.. id just need to learn more Sass and the way they did that proejct and I would then have a super strong understanding of that right. Then learn jQurey and JS form bootstrap and wuala!

Meanwhile doing some PHP.

My orginal question was is that code pure jQuery or JS? Prototyping is with pure JS right, they have made some jQuery or use it.

Oh, I know my ENglish is bad here, slept only 8 hours in 48hours ;d

1 Answer

Yes, bootstrap.js uses jQuery. A good tip is if you see a liberal use of the jQuery selector $("Something") used in the code. Also, you can see that it tests for the presence of jQuery at the very top of the code.

/*!
 * Bootstrap v3.3.7 (http://getbootstrap.com)
 * Copyright 2011-2016 Twitter, Inc.
 * Licensed under the MIT license
 */

if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

As far as if it uses "vanilla" javascript alongside jQuery, that answer is also yes. It isn't all one or the other, and that's the case most of the time.

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

So baiscally learning this i will learn jQuery and JS? but that get's confusing lol but i suppose i should dive in right. But that is amazing.