Skip to content

first pull request - #719

Open
Aiveteran wants to merge 12 commits into
bloominstituteoftechnology:masterfrom
Aiveteran:master
Open

first pull request#719
Aiveteran wants to merge 12 commits into
bloominstituteoftechnology:masterfrom
Aiveteran:master

Conversation

@Aiveteran

Copy link
Copy Markdown

No description provided.

@johnoro johnoro left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seemed to forget to do the arrays section of objects-arrays.js! You also missed the last 'step' of prototypes.js. Be sure to read the instructions carefully in the future. Good work!

Comment thread Answers.md
the major diffrence between methods and functions is that methods are tied to a specific class
closure is the accessibility of a variable in its lixicle scope
there is default binding where 'this' refers to global scope, implicit binding is when "this" is called by a preceding dot the object for it is "this", new binding is when a constructor function is in use "this" refers to the object created by that constructor function, explicit binding is when javascripts call or apply method is in use and "this" is explicitly defined.
super is a keyword use to call functions from parent object onto child object. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes; its primary use is just with the constructor (super(arguments))! Using other methods with super isn't as common.

this.weight = attributes.weight || 'weight unkown';
this.length = attributes.length || 'length unkown';
this.period = attributes.period || 'period unkown';
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's smart to make a class here and use its constructor for your objects! You actually weren't required to make this that advanced, though. You could've just made three objects without using a class or constructor function.

weight: '7000kg',
length: '12m',
period: 'Late Cretaceious'
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, doing this without your class:

const tyrannosaurus = {
  name: 'tyrannosaurus',
  diet: 'carnivorous',
  weight: '7000kg', 
  length: '12m',
  period: 'Late Cretaceious'
};

Comment thread challenges/functions.js
function add(w,e) {
return w + e;
}
function multiply(w,e) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do w and e represent and mean? Choosing meaningful variable names is better than single-letter variables!

Comment thread challenges/prototypes.js
Formula for cuboid volume: length * width * height
*/

CuboidMaker.prototype.Volume = function(){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically we use lowercase, at least for single word variables (we specifically use camelCase for multi-word variables in JavaScript) for variables. Try to keep to this style! It'll pay off in time so that you don't have to go back and wonder how you capitalized a certain name:

 CuboidMaker.prototype.volume = function(){ ... }

Classes (or, at least, constructors built using class syntax) and constructor functions are one of the few exceptions (where we use PascalCase).

Comment thread challenges/classes.js
// console.log(cuboid.volume()); // 100
// console.log(cuboid.surfaceArea()); // 130
console.log(cuboid.volume()); // 100
console.log(cuboid.surfaceArea()); // 130

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem to be missing a declaration of cuboid here. Try using this object for your dimensions for your cuboid variable next time:

{ length: 5, width: 4, height: 5 }

Comment thread challenges/classes.js
return this.length * this.width * this.height;
}

surfacArea(){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note the spelling(/capitalization) errors here:
surfacArea should be surfaceArea
and
Volume should be volume
since that's how they're called down below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants