Most voted "function" questions
The function (also called procedure, method, subprogram, or routine) is a portion of code intended to perform a single, specific task.
Learn more…1,309 questions
Sort by count of
-
0
votes2
answers102
viewsHow to create an Animation in Javascript using For
I’m trying to make a Div have the background changed to the three primary colors in case Yellow, Blue and Red, however would only start to change the color 4 seconds after the page is updated, wrote…
-
0
votes3
answers101
viewsFunction if you change css
Good afternoon! I have a filter on my site that shows certain partners of my company, but whenever I select a filter that has few logos of the partners the Divs are all left. I need a function that…
-
0
votes1
answer177
viewsFunction Return Java Script
I did a lot of research on callbacks and asynchronous in javascript. Function Helloworld.prototype.getCont searches the ID of an account and returns an EX number: 1; Function…
-
0
votes1
answer253
viewsAdd parameters dynamically in a Javascript function
You guys, it’s okay? I am trying to create a function (I will call to execute) that takes as parameter another function (I will call word), a list of objects and a list of attributes to be accessed…
-
0
votes1
answer362
viewsHow to call a function in an HTML form?
Hello, I need help, I am creating a javascript program that should receive input data (Height and width) via form HTML and then call a function that uses this data to calculate and display the total…
-
0
votes0
answers37
viewsString assigned to a variable that is not in a list
In this code below I want Python to return me the traffic signal of 4 simultaneous traffic lights. As the results are random, sometimes it returns me the correct that would be: One headlamp with…
-
0
votes1
answer260
viewsFunction with pEqual error
Hello, I am in the following statement trying to complete: "Oh, but it doesn’t end here" - said Ana "I want to know how many months there was profit, IE, the balance was greater than zero" .…
-
0
votes1
answer86
viewsHow to return a query column within a class
I’m updating my entire project to object-oriented PDO, but I’m having some difficulty returning a fetch column in the class query User. After several attempts, so was my code: user php. Class User {…
-
0
votes2
answers322
viewsInsert a Count(*) value into a variable in Postgresql
I am migrating from Mysql to Postgresql and trying to create the following Trigger: CREATE OR REPLACE FUNCTION verificaReservaQuarto() RETURNS trigger AS $$ begin declare ocupado int; declare…
-
0
votes0
answers16
viewsIs there a standard for Require, Include in PHP?
Hello, hello initiating in PHP and working on some projects at the same time, so I’m learning and solving at the same time, I realized that I end up using many includes and includes_once eventually…
-
0
votes1
answer205
viewsUse of For Cycle and Arrays
There are two exercises that I need to solve using a cycle (or loop) FOR... In one of them, I need to catch one array x as a parameter in a function, and multiply all its elements among themselves…
-
0
votes1
answer137
viewsStyling Elements with Function (Javascript)
I’m creating a javascript exercise, my idea was to create a function that would give me as return an icon, I’m using the Fontawesome for this. I managed to make him show the icon and the message but…
-
0
votes2
answers53
viewsInput with less than three characters triggers function
I’m performing a fixation exercise that asks for the following: The count is not working, it is picking up as if the number is greater than 3, for example number 12, and not if it has MORE than 3…
-
0
votes1
answer40
viewsDuplicate Array in Function
I created a script where inside my object it would calculate the percentage of an array, in this same object it contains a function that calculates the sum of my percentage with my array. However…
-
0
votes1
answer108
viewsFunction statement within Python FUNCTION
I’m trying to declare a function that shows a line below the result of another function. This line adapts to the size of the returned result in the 'main' function. Follow the code and error message…
-
0
votes1
answer35
viewsHow to direct a link to one of the tabs of a Bootstrap 4 list group
need to access a tab of a bootstrap 4 list group from a link on another page. On the first page I have: link1 Link2 link3 When I click on Link2, I want you to go to the other page and already fall…
-
0
votes1
answer973
viewsCould you create a function to decrease the number of if’s in the program?
There is a way to make a function that can reproduce that amount of if’s in the program so that they do not appear ? mensagem = (''' Escolha a conversão que você deseja : 1) Celcius-Fareheint 2)…
-
0
votes1
answer120
viewsError passing variables as parameters in powershell
Hello A Powershell script has the following code: function GetPerfis { [CmdletBinding()] param( [Parameter(Mandatory)] [string]$StartDate, [Parameter(Mandatory)] [string]$EndDate ) $cmd = New-Object…
-
0
votes1
answer72
viewsI can’t enable javascript function
I’m trying to implement a very simple function of leasing a particular product. I need the id is read within a field and activated with the button Schedule. But the function is not activated when I…
-
0
votes1
answer75
viewsWhy doesn’t my Div, raised in JS, show up?
My goal is to create a different red square every time one clicks the button. only that when one clicks on the button nothing expected happens. but one can know that the addeventlistener is working…
javascript function javascript-events create elementsasked 4 years, 8 months ago Henrique Sathler 21 -
0
votes1
answer236
viewsRun mouseover function on Avascript only once
I have a function that does some actions inside my html, the main is, this function does a request with ajax and returns me a list that is included directly in select. need q she make request only…
-
0
votes1
answer93
viewsBasic closures
Sirs, I’ve been studying Python for about four months and now I’m entering the most complex concepts of language. I’m having a little trouble assimilating decoradores but I understood that first I…
-
0
votes2
answers142
viewsProblems for player play order in Tic-tac-toe
I have trouble with the job players(), because I can’t increment the variable n, the function is only returning "X". I know it sounds pretty simple, but I can’t identify the problem. Can anyone help…
-
0
votes1
answer66
viewsCustom menu
I’m creating a simple script with a def I printed out a custom menu. The first parameter is the header, followed by the number of items accessible by the menu and finally a third parameter that is…
-
0
votes1
answer46
viewsFunction parameter eeprom_write_block
Hello! I was performing some tests using the library avr/eeprom.h in my Arduino. One of its functions is to eeprom_write_block(x, y, z), writing a memory block on the EEPROM. The first parameter (x)…
-
0
votes2
answers359
viewsHow to intersperse the values of two rows in C, in a third row?
I am trying to intermediate the values of two rows in C, F1 and F2, in a third row, inter, as function below (n would be the amount of F1 and F2 elements): Fila *intercala_fila (Fila *f1, Fila *f2){…
-
0
votes2
answers148
viewsFunction that displays the characters of a repeating string
Example: In the string "programming" the characters 'a', 'o' and 'r' must be returned. I did so but did not return what is requested. #include <stdio.h> #include <stdlib.h> #define DIM…
-
0
votes1
answer49
viewsHow do I make the function not return the value if the number is not binary
I am trying to make a limiter so that every time the user type a number that is not binary, receive an alert with the message "Write a binary number" however the problem is that the code sends the…
-
0
votes2
answers43
viewsError in display of dictionary information
I am early in python and I am having a difficulty in the following code: class Gerador: def __init__(self, nome, potencia, capacidade_energia, capacidade_combustivel): self.__nome = nome…
-
0
votes1
answer95
viewsSkip line in a function with implementation
I created a function pularLinha() so you don’t have to keep repeating <br> constantly, however to make the line jump more than once inside the function mostra(), I call pularLinha() twice.…
-
0
votes1
answer311
viewsValidate Cpf’s from a query
Opa gente, to trying to validate the cpfs of a query, are several Cpf"s. I have the following function to validate Cpf, but I’m not getting call-there I’m trying to do it like this: SELECT…
-
0
votes1
answer149
viewsRecursive function JS
I’m studying a little recursive function and I came across an exercise that’s taking my sleep, because it’s a basic exercise and I don’t understand the way out. Basically the book asks to create a…
-
0
votes1
answer42
viewsUse arguments in a function from another function
I have a text document with the following format: word_1 word_2 word_3 word_4 word_5 word_6 For each line of that text document: first: I want to save the words and add "_info" to each word; second:…
-
0
votes1
answer26
viewsCall to Undefined Function storeExcelView() using Maatwebsite
I have the following problem, I’m getting this message: Call to Undefined Function App Jobs Pit Reports Placar storeExcelView() Detail: I am using PHP 7.2 and Laravel 6. The same code in PHP 5.6 and…
-
0
votes1
answer1695
viewsHow to add values of an object array[JS], with only functions and loop for?
That is the question: Sum of expenditure and revenue Create a program that calculates the sum of revenue and expenses of users and at the end returns the balance (revenue - expenses). Use the user…
-
0
votes0
answers15
viewsRestrict type of argument from a Python method
I need to define a class in Python, which will receive a series of parameters. I would like to make the methods receive arguments of a certain type. An example of the code: class Teste(): def…
-
0
votes2
answers652
viewsPython 3.8 - How to format the display of the elements of a list in column
Hello. My code currently: To fill the list: lista = [] def preenche_Lista(): while True: espaco ="|______" nomeAluno = str(input('Qual o nome do estudante? - Digite FIM para encerrar ->…
-
0
votes1
answer56
viewsProblems with the <string. h> library
Good evening, everyone! I am developing a work of college using functions, structs and files, and I am having problems exactly with the library <string.h>. Basically, the user registers and…
-
0
votes1
answer473
viewsHow to insert the value of an Array within another Array
I’m trying to separate students according to their numbers in the notebook where students grade A would be students numbering over 170, students B students numbering 160 to 169 and students C…
-
0
votes1
answer1136
viewsPush notifications with Expo and React Native
I’m developing an app that needs to notify the user, I’m using Expo and React Native to develop Following the Expo Documentation I can correctly notify with: import * as Notifications from…
-
0
votes1
answer39
viewsError inserting data in mysql and php
I’m kind of a beginner dealing with php and would like some help to understand why this is happening I am having the following problem, when I run the following php Function, it does not return…
-
0
votes2
answers87
viewsI do not understand the error None in this function
I cannot understand why in the end this function does not return a string. The error is in fptr.write(result + '\n'), as if the function returns an object of type None. def dnaComplement(s):…
-
0
votes1
answer40
viewsReturn all JSON items with forr
Come on, guys, I need some help. I have a Function GET http and returns an array of JSON objects and would like to return the data contained in these objects, currently it returns like this: {…
-
0
votes1
answer49
viewsWhy do I get the message from Property is Undefined even with Arrow Function?
I’m starting with React and can not understand why the code below does not work. I receive the following message: "Typeerror: can’t access Property "aoClicarNota", this is Undefined" I’m already…
-
0
votes2
answers68
viewsI’m learning JS and was testing functions and have a doubt
I was testing Function and wanted to make it detect ! of a message: //Detector de ! function detector(){ var detector = txt.indexOf("!") if(detector>-1) return true } //reponder a mensagem…
-
0
votes2
answers48
viewsHow to run a function only once and stop it if an onBlur occurs?
I have two inputs: what is typed in the "Title" is duplicated in the "Material Code" with the appropriate normalizations (i.e. space conversion and character removal). Is there any way - using pure…
-
0
votes1
answer92
viewsHow to get this.data from an input with onkeyup
I need to get the data of an input with javascript. In this way, I created an up-to-date function. function atualizaAdicionados(e){ console.log(e.value); console.log(e.data('id')); } <input…
-
0
votes3
answers50
viewsHow to declare a function that has calls with quantities of different parameters?
I have a function that is called every time the input element is in focus, only the calls are made with a number of different parameters. How to declare the same function with passing variable…
-
0
votes1
answer76
viewsHelp with recursive function in Python
I am a beginner with a lot of difficulty in understanding the recursive function, I know it is a function that calls itself, but I can not make it work happily, in the exercise practiced in class,…
-
0
votes2
answers56
viewsIs it appropriate to use If-Else in a function along with Fetch?
I’m creating a function with a . fetch to get data from openweathermap.org, which by definition returns in Fahrenheit. Is it acceptable from the point of view of Clean Code, which says that the…