pjs-capstone-lodash's Issues
Summary
pjs-capstone-lodash/lodash/_.js
Line 134 in a767d77
Rubric Score
Criteria 1: Functionality
- Score Level: 3 (Meets Expectations)
- Comment(s): All main functionality and edge cases are properly implemented. All tests in the test suite are passing.
Criteria 2: Code Style - Formatting
- Score Level: 3 (Meets Expectations)
- Comment(s): All code is consistently indented and formatted. All indents are the same size. Each new block is indented at the beginning of the block's content and unindented after the block ends. Every line that should end in a semi-colon does. Only one empty line is added when line breaks are being used. Variable are named descriptively.
Criteria 3: Code Style - JavaScript Techniques
- Score Level: 2 (Meets Expectations)
- Comment(s): Code demonstrates some good practices, but could be optimized for an ES6+ world. Variables are declared, though often not with appropriate keywords.
Overall Score: {8/12}
Great work!
Redundant Code
pjs-capstone-lodash/lodash/_.js
Lines 26 to 31 in a767d77
Although this is entirely correct, it is a very redundant set of code. In fact, it can be simplified to just 1 line, and you have already written it. A boolean variable can be replaced with an expression, because all expressions simplify to either true
or false
. Knowing that, you can replace all of this code with just the conditional you placed in the if statement: number >= start && number < end
.
Unnecessary Variables Part 2
pjs-capstone-lodash/lodash/_.js
Lines 89 to 90 in a767d77
This is an important concept so I'm going to go into a little more detail, as the other example was just once case. Generally, if you only use a variable once after creating it, you don't need to create a variable. Here, you could have just written if(predicate(value))
. Not only do you save memory, you also save time. This is one additional line that the computer will no longer have to read. Now, one line may not seem like much, but keep in mind that this one line is in a for-loop, so you're actually saving time with every single iteration!
Great Use of Const
pjs-capstone-lodash/lodash/_.js
Line 47 in a767d77
Creating Unnecessary Variables
pjs-capstone-lodash/lodash/_.js
Lines 53 to 54 in a767d77
This might seem nitpicky, but one of the main jobs of programmers is to be as efficient as possible. Whenever we create a variable, our computer creates space in its memory for that variable, so it is best to avoid creating them if they're unnecessary. For this code, instead of creating a new variable you can just return the expression that you set paddedString equal to.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.