Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Search results

  1. S

    What should I do Before I give up programming?

    I'm in the verge of giving up programming and wondering what could I do before I give up to make sure I did what everyone did. I've a bachelors degree in computer science. I didn't do it as well as I'd have liked to do, but that degree has gave me familiarity with most terms used in basic...
  2. S

    JavaScript How to reflect the ball at an angle?

    Here's the full code: https://codepen.io/pelko/pen/MWBpNmL When a ball collides with bat or walls, I want the ball to be reflected with an angle, how do I do it? I suspect there's lots of physics to it. So, should I stop this project here? I'd have to probably build a part of game engine…Can...
  3. S

    JavaScript How to paint an element in screen using javascript?

    <div class="body"> <div id="board"> <div id="bat" class="bat"></div> <div id="ball" class="ball"></div> </div> </div> This is my HTML. I've done CSS For all of them and generated this: Now, I want the bat to move left and right when I press arrow keys...
  4. S

    JavaScript input Direction confusion in snake game javascript?

    My confusion is cleared. arrSnake=[{x:0,y:1}] inputDir={x:0,y:1} are 2 different object names. It doesn't matter if we use same key name for both of them.
  5. S

    JavaScript input Direction confusion in snake game javascript?

    I must tell why my confusion came here: Earlier in the code, we’ve done this: //head of snake let snakeArr = [ { x: 13, y: 15 } ] Here x,y means the grid row 13, grid column 15. That is why I’m confused. We’re using same variable names in 2 places with different meanings. In this...
  6. S

    JavaScript input Direction confusion in snake game javascript?

    Here's the full code: https://codepen.io/pelko/pen/jOpBmPN This is the code that I'm interested in: window.addEventListener("keydown", e => { inputDir = { x: 0, y: 1 }; moveSound.play(); switch (e.key) { case "ArrowUp": inputDir.x = 0; inputDir.y = -1; break...
  7. S

    JavaScript Why will the if condition be executed in this recursive snake game?

    I'm currently watching tutorials to build projects as I'm still not in a phase where I can carve a project that I want all on my own. Currently, working on a snake game. let speed = 2; let lastPaintTime = 0; //Game functions function main(ctime) { window.requestAnimationFrame(main); if...
  8. S

    JavaScript How does props program flow work in react js?

    1) Start with App.js 2) It returns Users component. 3) Inside Users component we pass properties name and job. 4) Inside Users.js we access it using props.name and props.job. A figure that helped me
  9. S

    JavaScript How does props program flow work in react js?

    App.js: import React from 'react' import Helloworld from './components/HelloWorld'; import Users from "./components/Users"; const App = () => { return ( <div> <h1>List of Users</h1> <Users name="Zino Emi" job="Developer" /> <Users name="Lionel Messi" job="Web Developer"...
  10. S

    Date not passed via props in react js

    FIXED: date.toISOString should be date.toISOString()
  11. S

    Date not passed via props in react js

    App.js import './App.css'; import Subscription from './components/Subscription'; // import Myroutes from "./Myroutes.js"; function App() { let subscriptions = [{ id: "1", date: new Date("2021", "3", "23"), title: "Monthly Subscription", amount: "125.60" }, { id: "2", date: new Date("2020"...
  12. S

    CSS Bring navbar at center CSS

    any better ways to target that element? ul will be horrendous way of targetting it. I'll have other uls later that's why.
  13. S

    CSS Bring navbar at center CSS

    I want to do it using flex.
  14. S

    CSS Bring navbar at center CSS

    https://demo.w3layouts.com/demos_new/template_demo/28-07-2021/biodata-liberty-demo_Free/2002651968/web/index.html This is the website that I am trying to build. This is my current navbar. This is what I want to build. My focus is on "Home" to "Contact". I want to put it at the center of the...
  15. S

    HTML Input type checkbox not working properly in HTML.

    It's a typo in the tutorial ig.
  16. S

    HTML Input type checkbox not working properly in HTML.

    https://webplatform.github.io/docs/guides/html_forms_basics/ Look at The value attribute. I guess the tutorial is wrong then.
  17. S

    HTML Input type checkbox not working properly in HTML.

    <body> <form> <div> <input type="checkbox" name="mailing-list" id="mailing-list" value="no" /> </div> <div> <input type="submit" value="SUBMIT" /> </div> </form> </body> Initial value of checkbox is “no”, I click in checkbox...
  18. S

    Python page not found 404 django

    yeah ikr. I don't know how to update that part. That's the question. I tried but it failed.
  19. S

    Python page not found 404 django

    Goal: 127.0.0.1:8000/about Should give: welcome to to about us page 127.0.0.1:8000/contact Should give: welcome to contact page Problem: Both are giving "page not found at /" Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/contact/ Using the URLconf...
  20. S

    Why did we remove multiple document types within an index in ElasticSearch?

    The answer is this-: Because we can't declare a field of different data types within a same index in different document types. Say there's an index called "college". Then there are document types called "student" "teacher" "administration" "staff". What problem would occur if we allow this...
Back
Top Bottom