Computers don't speak English or Spanish, they speak Machine Code. Machine code is a computer programming language comprising binary instructions which computers respond to directly, It's written in machine language. Therefore, a machine i.e., a computer, can execute it without any translation or conversion.
So then, How do computers read the code we write in a programming language? If we gave computers the text of the logic and instructions we want to execute with a set program, the computer wouldn't have a way to read it and execute it.
A programming language allows us to translate the abstract 1 & 0's / Binary
into something humans can understand.
- High-Level Ex: Java, Javascript, Python, C# and many more.
Upside: Easier for us to understand the syntax and write code.
Downside: It takes longer to translate into machine code.
- Low-Level Languages that are closer to Machine Code therefore easier for the computer to read.
Benefits Include: They're fast, precise control on how they want the computer to function.
Ex: Machine code, Assembly Language
We need to get our Source Code converted into Machine code somehow before it can run:
There are two ways to turn Source code into machine code and it's up to the language you're using Compiled
or Interpreted
language.
-
Compiled: Source Code Compiler Program : Translates Source Code into Machine Code and makes it an Executable file (Machine Code) Separate Executable file on Machine Code Executable File
-
Interpreted Source Code Interpreter Program (turns it into machine code on the fly, line by line, on the spot) Processes on the spot (Not saved as a another file) Ex: Javascript interpreted into the web browser
Pros | Cons |
---|---|
ready to to run | not cross platform |
often faster | inflexible |
source code is private | extra Step |
Pros | Cons |
---|---|
cross-Platform | interpreter required |
simpler to test | inflexible |
easier to debug | source code is public |
Compiled: C, C++, Objective-C Interpreted: PHP, JavaScript Hybrid: Java, C#, VB.Net, Python
Intermidiate Approach:
Takes it as far as it can into Machine Code, often Assembly and let's the other party finish the rest.
JIT: Just in time compilation.
Java is an Intermidiate Hybrid approach where it's neither compiled or interpreted all at one time, it's done half and half, we compile one part of the way to what's called an intermidiate language which takes it as far as long to machine code as it can get while still being portable across platforms, you then distribute the Intermidiate Language
File sending it to the people who need to run it and each person who runs it takes it to the last step to take it to machine code. JIT Compilation / Bite Code.
- START
- BTC <--- GET FROM ('https://www.coinbase.com/price/bitcoin')
- USD <--- GET
- BTC2USD <--- BTC * USD
- Print BTC2USD
- END
Interpreted vs Compiled Programming Languages: What's the Difference? ^1
What is Machine code Video ^2.
Compiler and Interpreter: Compiled Language vs Interpreted Programming Languages ^3.
What is a programming language? ^4.
- https://www.freecodecamp.org/news/compiled-versus-interpreted-languages/
- https://www.youtube.com/watch?v=-XU3GbHBOKA&ab_channel=MarketingBusinessNetwork
- https://www.youtube.com/watch?v=I1f45REi3k4&ab_channel=CodingMentors
- https://www.youtube.com/watch?v=EGQh5SZctaE&ab_channel=Codecademy
DOB
: 2002
- 2^0 = 1
- 2^1 = 2
- 2^2 = 4
- 2^3 = 8
- 2^4 = 16
- 2^5 = 32
- 2^6 = 64
- 2^7 = 128
- 2^8 = 256
- 2^9 = 512
- 2^10 = 1024
- 2^11 = 2048
2^10 | 2^9 | 2^8 | 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
Anwser= 11111010010
Feedback on the Videos and Re-search
It was really interesting video to watch, gave me a perspective on how javascript has evolved over the las two decades and a half since it's release in Dec '95 Brendon Ike's, being banned by MS in the Internet Explorer, Ecma Standarizing JS, touch on the Tech Bubble of march 2000s, Jquery, sep 8 Chrome V8engine, May 2009 Node Js "Launch Web applications at scale", ES 3.1 == ES5, ES5 introduced (JSON SUPPORT, Functional array and object methods, stric mode, accessors many other), Single Page application frameworks Oct 2010: Backbone & Angular, similar problem different approaches. backbone was light weight Dom updates with imperative programming style, Angular Js more inclusive and use declarative programming, 2015 React Js included angular js with declarative UI but improve them with uni-directional data flow immutability and use of the virtual DOM. The creator of the video is Bullish on javascript, and has learned to always bet on javascript.
- Loops
- While
- For
- Conditionals
- Ternary Operator
- Functions
- Difference between arguments and parameters
- Default parameters
- Arguments array
- scopes
- var, let, const
- Operators
- TypesOf
- Data Structure
- Array
- List
- Stack
- Create a Code Wars Account
https://www.codewars.com/users/sbravo15
DONE
Code Wars Challenges
1. Multiply exercise DONE
function multiply(a, b){
return a * b
}
function uniTotal (string) {
let total = 0; //Variable Total
for (let i = 0, length = string.length; i<length; i++){
total += string[i].charCodeAt(); //Suma Charcode al total (Loopea el string y va sumando)
}
return total; //Retorna la variable total (Sum of the Chars)
}
4. Char From ASCII Value exercise DONE
function getChar(c){
let char = String.fromCharCode(c);
return char
}
5. Binary Addition exercise DONE
function addBinary(a,b) {
let sum = a+b;
let res = sum.toString(2); //to string(2) turns it into a binary number
return res
}
6. Student's Final Grade exercise DONE
function finalGrade (exam, projects) {
// final grade
if (exam > 90 || projects > 10){
let grade = 100
return grade
} else if (exam > 75 && projects>=5){
let grade = 90
return grade
} else if (exam>50 && projects>=2){
let grade = 75
return grade
} else{
return 0
}
}
Code Wars Challenges
1. Holiday VIII - Duty Free exercise DONE
function dutyFree(normPrice, discount, hol) {
/*
what would be the price of a bottle with the discount?
normalPrice --- 100%
dicountPrice --- discount%
*/
let dicountPrice = (normPrice * discount) / 100;
// How many bottles at the discount price will cover the hol cost?
let bottlesWithDicountPriceToCoverHoliday = hol / dicountPrice;
// Please return an integer. Round down.
let roundedResult = Math.floor(bottlesWithDicountPriceToCoverHoliday);
return roundedResult;
}
2. Twice As Old exercise DONE
WH
function twiceAsOld(dadYearsOld, sonYearsOld) {
return Math.abs(((sonYearsOld*2)-(dadYearsOld)))
}
3. Valid Spacing exercise DONE
WH
function validSpacing(s) {
// Verifica espacios vacios al Principio y al final del string
if (s.charAt(0) === ' ' || s.charAt(s.length - 1) === ' ') {
return false;
}
//Loopea el string : Si el char es espacio vacio y le suma un espacio y el otro es vacio == False
for (let i = 0; i < s.length; i++) {
if(s.charAt(i) === ' '){ // es el caracter que estamos viendo igual a un espacio?
if(i != 0 && s.charAt(i-1) === ' ') {
return false;
}
if (i != (s.length - 1) && s.charAt(i+1) === ' ') {
return false;
}
}
// ....
}
return true; // fuera la verificacion
}
4. Fake Binary exercise DONE
WH
function fakeBin(x){
let resultDigits = "";
for (let i=0; i< x.length; i++){
if(parseInt(x[i]) < 5){
resultDigits = resultDigits +"0";
}else {
resultDigits = resultDigits + "1";
}
}
return resultDigits;
}
Code Wars Challenges
1. Remove All Exclamation Marks From The End Of Sentence exercise DONE
function remove (string) {
//Implementation (regex)
return string.replace(/!+$/, "");
2. Vowel Remover exercise DONE
function shortcut(string){
return string.replace(/[aeiou]/g,'')
}
3. Rock Paper Scissors! exercise DONE
const rps = (p1, p2) => {
//rock & rock // p & p // s & s
// rock < paper // paper < scissor //scissor < rock //
if (p1 === "rock" && p2 === "scissors"){
return "Player 1 won!";
}else if(p2 ==="rock" && p1 === "scissors"){
return "Player 2 won!";
}else if(p1 === "paper" && p2 === "scissors"){
return "Player 2 won!";
}else if(p2 === "paper" && p1 === "scissors"){
return "Player 1 won!";
}else if( p1 === "rock" && p2 === "paper"){
return "Player 2 won!";
}else if( p1 === "paper" && p2 === "rock"){
return "Player 1 won!";
}else{
return "Draw!";
}
};
4. Persistent Bugger exercise n/a
- Object
- DOM API
- ES6 features
- Template strings
- Arrow functions
- Rest/Spread operator
- Destructuring assigment
- Array Map
Code Wars Challenges
1. Who Likes It? n/a
2. Bit Counting n/a
Code Wars Challenges
1. Simple Pig Latin. n/a
Code Wars Challenges
2. Convert String To Camel Case n/a
Code Wars Challenges
1. Fold An Array n/a
2. Encrypt This! n/a
- ✨Complete your 1st Core Challenge. This is one of the requirements for the certification, where you'll boost your dev professional-brand.
n/a
- Regular expressions
- Array Reduce
- Array Filter
- Q&A
-
Learn about for loop
-
Follow this JavaScript Array Filter video
-
Follow this JavaScript Array Reducer video
-
Follow this JavaScript Array Map video
- Watch this Regular Expressions (RegEx) video
- Read Regular Expressions - MDN documentation
- Learn about replace in this video
- Read replace - MDN documentation
- Check Regexr, a tool to test your regular expressions
- A complete Regular Expressions video
1. Simple Calidation of a Username exercise n/a
2. Get Number from String exercise n/a
1.String Cleaning exercise n/a
2.Password Validation exercise n/a
- ✨Complete your 2nd Core Challenge. This is one of the requirements for the certification, where you'll boost your dev professional-brand.